Horizontal Center Items Inside Navigationdrawer
I have the following Navigation Drawer menu setup: Main layout activity_main.xml:
Solution 1:
Try this for the
menu_item.xml
<?xml version="1.0" encoding="utf-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="wrap_content"android:gravity="center"><ImageViewandroid:id="@+id/image_view"android:layout_width="match_parent"android:layout_height="75dp"android:layout_gravity="center|center_horizontal"android:src="@drawable/menu_icon" /><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_below="@+id/image_view"android:layout_gravity="center_horizontal|center"android:gravity="center"android:text="Menu Title"android:textColor="@color/white"android:textSize="16sp" /></RelativeLayout>
Hope this helps
Solution 2:
Try this, menu_item.xml you can set gravity to center_horizontal.
Post a Comment for "Horizontal Center Items Inside Navigationdrawer"