Skip to content

Instantly share code, notes, and snippets.

@TOrnelas
Created November 10, 2017 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TOrnelas/4424d8892aac72c110cb19daf0392791 to your computer and use it in GitHub Desktop.
Save TOrnelas/4424d8892aac72c110cb19daf0392791 to your computer and use it in GitHub Desktop.
@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