Created
November 10, 2017 17:25
-
-
Save TOrnelas/4424d8892aac72c110cb19daf0392791 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public BottomMenuItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | |
final View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_bottom_menu, | |
parent, false); | |
BottomMenuItemViewHolder viewHolder = new BottomMenuItemViewHolder(itemLayoutView); | |
DisplayMetrics displaymetrics = new DisplayMetrics(); | |
final WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); | |
wm.getDefaultDisplay().getMetrics(displaymetrics); | |
int width = (int)(displaymetrics.widthPixels / (navigationMode == BottomMenu.NavigationMode.SCROll ? visibleItems : Math.ceil(visibleItems))); | |
viewHolder.itemView.getLayoutParams().width = width; | |
return viewHolder; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment