我有TextView的項目水平的ListView,我項目佈局:Android的ListView中選定的項目突出
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/activatedBackgroundIndicator">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="35dp" >
</TextView>
<View
android:layout_width="5dp"
android:layout_height="35dp"/>
</LinearLayout>
我想通過設置borded給它僅強調一個選擇項的TextView的,如。當我點擊item1時,我想看到帶有小邊框的這個項目,現在當我點擊item2時 - 這將突出顯示,並且item1的邊框將消失。
任何想法?
在此先感謝!
使用'ListView.getSelected()'應該返回列表項查看您想要突出顯示,找到其中的「TextView」,更改邊框並記住它以在選擇其他項目時重置邊框 –