2
我在做項目Android。我想更改background
顏色以及textcolor
的選定項目從列表查看。這裏是我的代碼在運行時更改Android中ListView的背景顏色
<?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:gravity="right"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ListView
android:id="@+id/listView1"
android:layout_width="265dp"
android:layout_height="366dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:layout_weight="0.00"
android:drawSelectorOnTop="true" >
</ListView>
</LinearLayout>
</LinearLayout>
所以,我有ListView
一些學生的姓名,並通過使用checkbox
選擇題的設施。
ListView stud_lst=(ListView) findViewById(R.id.listView1);
stud_lst.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
我想更改所選學生的背景和文本顏色。 我已經看到了一些答案,但我沒有得到它。 請幫幫我。
使自定義行對於listview.onclick更改自定義行的背景顏色和文本顏色。 – 2012-04-20 09:05:02
沒有使用自定義行的任何其他想法 – 2012-04-20 09:15:27