Reputation: 7980
I'm trying to remove or set transparent the horizontal bars separating each item in the navigation drawer menu.
Here is a screenshot from my app:
I want to remove or set same color as background color or set as transparent those horizontal grey bars.
Here's my XML code:
custom_drawer_item.xml
<.?xml version="1.0" encoding="utf-8"?>
<.RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#edf7f2"
android:divider="@android:color/transparent">
<!-- Accounts -->
<LinearLayout
android:id="@+id/spinnerLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:orientation="vertical"
android:divider="@android:color/transparent" >
<Spinner
android:id="@+id/drawerSpinner"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:id="@+id/headerLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical"
android:divider="@android:color/transparent">
<!-- Representing the category title in the navigation drawer -->
<TextView
android:id="@+id/drawerTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#96ca2d"
android:textAppearance="?android:attr/textAppearanceSmall"
android:divider="@android:color/transparent" />
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginBottom="1dp"
android:layout_marginTop="1dp"
android:divider="@android:color/transparent">
</View>
</LinearLayout>
<LinearLayout
android:id="@+id/itemLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="0dp"
android:orientation="vertical"
android:divider="@android:color/transparent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="50dp"
android:divider="@android:color/transparent">
<ImageView
android:id="@+id/drawer_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<!-- Menu Items -->
<TextView
android:id="@+id/drawer_itemName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#4bb5c1"
android:textAppearance="?android:attr/textAppearanceLarge"
/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:divider="@android:color/transparent">
</View>
</LinearLayout>
<./RelativeLayout>
drawer_list_item.xml
<.TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:minHeight="?android:attr/listPreferredItemHeightSmall"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:textColor="#4bb5c1"
android:divider="@android:color/transparent"
/>
drawer_layout.xml
<.?xml version="1.0" encoding="utf-8"?>
<.RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="?android:attr/activatedBackgroundIndicator"
android:divider="@android:color/transparent">
<ImageView
android:id="@+id/button"
android:layout_width="190dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:contentDescription="descri imagem"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" />
<./RelativeLayout>
PS; Don't mind the .
(dot) in the xml code, it's there just to enforce SO to show those lines otherwise for some reason those lines wouldn't be shown in my question.
Thanks!
Upvotes: 1
Views: 2524
Reputation: 7696
in your layout of activity that contains navigation drawer in the listview put these lines
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
Upvotes: 3
Reputation: 93
remove
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:divider="@android:color/transparent">
</View>
from your xml and then try it, must work
Upvotes: 0
Reputation: 2773
try to customize your items' background by setting a custom drawable:
1/ create a little file in your res/drawable : white_empty_background.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<solid android:color="@android:color/white" />
</shape>
2/ in your item's layout set this drawable as background.
Upvotes: 0