android - Can't center Navigation Drawer items vertically -


main activity layout (removed irrelevant elements):

<android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     android:id="@+id/drawer_layout"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@android:color/black"      <relativelayout         android:id="@+id/layout_relative_in_drawer"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:background="@android:color/black" >          // more elements ...      </relativelayout>      <listview         android:id="@+id/drawer_main"         android:layout_width="120dp"         android:layout_height="match_parent"         android:layout_gravity="start"         android:background="#80000000"         android:choicemode="singlechoice"         android:divider="@android:color/transparent"         android:dividerheight="10dp" />  </android.support.v4.widget.drawerlayout> 

drawer_item.xml:

<?xml version="1.0" encoding="utf-8"?> <textview xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/draweritemtextview"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:gravity="center"     android:layout_gravity="center"     android:textcolor="@android:color/white" >  </textview> 

the list items aligned center horizontally now, not vertically.

what should modify center them vertically?

change drawer item this:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="horizontal" >      <textview         android:id="@+id/frag1_text"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_marginstart="10dp"         android:textappearance="?android:attr/textappearancelarge" />  </linearlayout> 

then try, working me.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -