可以在ListView中设置,也可以在SimpleAdatpter里面设置 <ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="3dip"
android:background="#FFCCDDCC"
android:dividerHeight="4px"
android:cacheColorHint="#00000000"
android:paddingTop="5dp"
android:listSelector="#FFFF0000"
android:paddingLeft="5dp"
>
</ListView>android:listSelector可以设置为一个包含selector的xml,在selector里面就可以设置是否按下,有无焦点时的背景也可以在SimpleAdatpter中设置,直接用setBackgroundResIDd(),传一个包含selector的xml进去就可以了selector.xml的例子,这个xml放在drawable下面<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/list_deft" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_slct" />
<item android:state_focused="true" android:drawable="@drawable/list_slct" />
</selector>
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="3dip"
android:background="#FFCCDDCC"
android:dividerHeight="4px"
android:cacheColorHint="#00000000"
android:paddingTop="5dp"
android:listSelector="#FFFF0000"
android:paddingLeft="5dp"
>
</ListView>android:listSelector可以设置为一个包含selector的xml,在selector里面就可以设置是否按下,有无焦点时的背景也可以在SimpleAdatpter中设置,直接用setBackgroundResIDd(),传一个包含selector的xml进去就可以了selector.xml的例子,这个xml放在drawable下面<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="false" android:state_pressed="false" android:drawable="@drawable/list_deft" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_slct" />
<item android:state_focused="true" android:drawable="@drawable/list_slct" />
</selector>
太感谢了, 结贴给分。
在我的另一个帖子http://topic.csdn.net/u/20100702/14/520af85f-357c-4446-8618-4debd9cd8e19.html里面,我已经结贴了,不知道您是否得分了?
因为结贴的时候网络正好出现问题,好像没有提交上去,但是后来再次结贴时系统提示该贴已经结了。