Centered icons in MiniDrawer
EpsilonOrionis opened this issue · comments
How (if it is possible) can I center the icons in the MiniDrawer?
@EpsilonOrionis the icons of the MiniDrawer
are centered. (when having the MiniDrawer with 72dp width)
I used your code to create the MiniDrawer. Isn't it with 72dp width MiniDrawer?
@EpsilonOrionis yes it is. i just checked the sample app. the icons are centered :O. can you post a screenshot
I can, but it isn't needed because i have the same result shown in the screenshot example in the Readme project file. But if you need a screenshot I'll upload it as soon as I can.
they are centered in the screenshot :O
@EpsilonOrionis code from MaterialDrawer #720
//remove the recyclerView from the slider
result.getSlider().removeView(result.getRecyclerView());
//create new linearLayout which will contain the recyclerView
LinearLayout ll = new LinearLayout(this);
//center the recyclerView within this container
ll.setGravity(Gravity.CENTER);
//height of the items * the amount of items
int height = getResources().getDimensionPixelSize(R.dimen.material_drawer_item_primary) * 2;
//add back the recyclerView in the new linearLayout container
ll.addView(result.getRecyclerView(), new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, height));
//add the new linearLayout container to the drawer slider
result.getSlider().addView(ll, new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));