Setting A Margin For Navigationdrawer Items
My problem is that I can't correctly set up the margin in my navigation drawer. I have tried changing margin of any view and item but it doesn't seem to work out. All I get is spac
Solution 1:
Try this :
Using the help of Theme.add theme in DrawerLayout.
<stylename="NavigationTheme"parent="AppTheme"><itemname="android:layout_marginTop">5dp</item><itemname="android:layout_marginLeft">10dp</item></style>
Hope, this will help.
Solution 2:
Try this as item
<TextViewxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="wrap_content"android:background="#fff"android:padding="20dp"android:textAppearance="?android:attr/textAppearanceLarge"android:textColor="#222"android:text="bla bla bla" />
and main xml as this
<android.support.v4.widget.DrawerLayoutxmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:layout_height="match_parent"android:layout_width="match_parent"android:id="@+id/drawer_layout"><android.support.v4.widget.SwipeRefreshLayoutandroid:layout_height="match_parent"android:layout_width="match_parent"android:id="@+id/refreshSites"tools:context=".MyActivity"><android.support.v7.widget.RecyclerViewxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/sitesList"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="5dp"/></android.support.v4.widget.SwipeRefreshLayout><RelativeLayoutandroid:layout_width="280dp"android:layout_height="fill_parent"android:id="@+id/drawerPane"android:layout_gravity="start"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><ListViewandroid:id="@+id/left_drawer"android:layout_width="280dp"android:layout_height="match_parent"android:layout_gravity="start"android:choiceMode="singleChoice"android:divider="@android:color/white"android:dividerHeight="0dp"android:background="#FFF"></ListView></LinearLayout></RelativeLayout>
Hope, this will help.
Post a Comment for "Setting A Margin For Navigationdrawer Items"