listview边框在焦点时删除

时间:2013-08-30 06:37:14

标签: android android-layout android-listview

我的列表视图在焦点或长按此方式时移除边框

image

下面是我的listview代码,请帮助我为什么边框会在焦点时移除??? 一切都很好只有列表视图边框会在长按时删除

我编辑我的代码,请立即查看

  <LinearLayout
 android:id="@+id/lytContent"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:layout_marginLeft="10dp"
 android:layout_marginRight="10dp"
 android:background="@drawable/layout_border"
  android:orientation="vertical" >

  <ListView
    android:id="@+id/listMainMenu2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:dividerHeight="1dip"
    android:fadeScrollbars="true"
    android:listSelector="@drawable/listview_selector" />

 </LinearLayout>       

&LT; ----- ---- listview_selector.xml&GT;

 <?xml version="1.0" encoding="utf-8"?>
 <selector xmlns:android="http://schemas.android.com/apk/res/android" >

 <item
    android:drawable="@drawable/listviewborder"
    android:state_focused="true"/>
 <item
    android:drawable="@drawable/listview_selector_pressed"
    android:state_pressed="true"/>

 </selector>               

&LT; ----- ----- listviewborder.xml&GT;

  <?xml version="1.0" encoding="utf-8"?>
  <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >

<item>
    <shape android:shape="rectangle" >
        <solid android:color="#000000" />
    </shape>
</item>
<item
    android:bottom="1dp"
    android:left="1dp"
    android:right="1dp"
    android:top="1dp">
    <shape android:shape="rectangle" >
        <gradient
            android:angle="90"
            android:endColor="#56768d"
            android:startColor="#0a89f1" />
    </shape>
</item>

  </layer-list>                 

&LT; ------ ------ listview_selector_pressed&GT;

   <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item> 
<shape android:shape="rectangle">
  <solid android:color="#000000" /> 
</shape>
   </item>   
<item android:left="1dp" android:right="1dp"  android:top="1dp" android:bottom="1dp"  
    >  
 <shape android:shape="rectangle"> 
 <gradient
  android:startColor="#0a89f1"
     android:endColor="#56768d"
      android:angle="90" />
     </shape>
      </item>    
        </layer-list> 

&LT; ----- --- layoutborder.xml&GT;

           <?xml version="1.0" encoding="UTF-8"?>
      <shape xmlns:android="http://schemas.android.com/apk/res/android" >

<solid android:color="#FFFFFF" />

     <stroke
    android:width="3dip"
    android:color="#B1BCBE" />

       <corners android:radius="10dip" />

      <padding
    android:bottom="0dip"
    android:left="0dip"
    android:right="0dip"
    android:top="0dip" />

      </shape>

0 个答案:

没有答案