2014-07-27 26 views
0

screenshot of drawer 我在我的app中有一個android導航抽屜工作正常,但是當我的抽屜可見時,它在項目之間有兩個分隔線。 一個紅色的(我想我已經做的),在白色的其他(我不知道它是從哪裏來的)導航抽屜中的兩個分隔線

這裏有我的兩個抽屜文件

custom_drawer_item.xml

<?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" > 

<LinearLayout 
    android:id="@+id/itemlayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentLeft="true" 
    android:orientation="vertical" 
    android:layout_marginTop="0dp" 
     android:background="?android:attr/activatedBackgroundIndicator" 

    > 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:minHeight="60dp" 

     > 

     <ImageView 
      android:id="@+id/drawer_icon" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:paddingRight="6dp" 
      android:paddingTop="10dp" 
      /> 

     <TextView 
      android:id="@+id/drawer_itemName" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:textAppearance="?android:attr/textAppearanceLarge" 
        android:textSelectHandleLeft="@+id/drawer_icon" 
        android:textColor="#ffffff" 

        android:paddingTop="10dp" 
         /> 
     </LinearLayout> 

    <View 
    android:layout_width="match_parent" 
    android:layout_height="1dp" 
    android:layout_marginBottom="1dp" 
    android:layout_marginTop="1dp" 
    android:layout_marginLeft="10dp" 
    android:layout_marginRight="10dp" 
    android:background="#DADADC" 

    ></View> 

</LinearLayout> 



</LinearLayout> 

activity_main.xml中

<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 



<FrameLayout 
    android:id="@+id/content_frame" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

</FrameLayout> 

<ListView 
      android:id="@+id/leftdrawer" 
      android:layout_width="200dp" 
      android:layout_height="match_parent" 
      android:layout_gravity="start" 
      android:choiceMode="singleChoice" 
      android:divider="#B80000" 
    android:dividerHeight="1dp" 
    android:background="#076672" 

    /> 

</android.support.v4.widget.DrawerLayout> 

如果你仍然不能得到它請讓我爲image.il顯示 日Thnx提前

+0

你能附加圖像嗎? – Charlesjean

+0

https://www.dropbox.com/s/e0vnljid1j7cxjg/Screenshot_2014-07-27-17-10-12.png –

回答

0

這是因爲你有一個View這樣的:在您的custom_drawer_item.xml佈局的底部

<View 
    android:layout_width="match_parent" 
    android:layout_height="1dp" 
    android:layout_marginBottom="1dp" 
    android:layout_marginTop="1dp" 
    android:layout_marginLeft="10dp" 
    android:layout_marginRight="10dp" 
    android:background="#DADADC"> 
</View> 

+0

thanx它的工作!但是你能做些什麼? –

+0

@ Farhanpatel很簡單。 Yoh在這個代碼中有一個紅色的代碼:'android:divider =「#B80000」'in your activity_main.xml'並且有一個高度爲1dp的'View',它的值接近白色。然後,listview從'custom_drawer_item.xml'加載每一行。所以你看到了兩個分頻器。 –

0

我認爲這兩個分隔線之一是ListView的分隔線,另一個是您添加到您的custom_drawer_item.xml中的視圖,該視圖的高度爲1dp。
你可以刪除你不想要的。