【发布时间】:2018-03-31 01:19:43
【问题描述】:
如果我在 ListView 中选择 ONE 行,它会突出显示,但每当我进入 MultipleSelection 模式(onLongClick、# selected rows、Contextual Action Bar)时,我选择的其他行不会保持突出显示但是 是根据 CAB 选择的,正如它所说的,“3 个选定的行”。
main.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
...
>
<HorizontalScrollView
...
>
<LinearLayout
...
>
<TableLayout
...
>
<TableRow
...
>
<TextView
...
/>
<TextView
...
/>
</TableRow>
</TableLayout>
<ListView
android:id="@+id/db_op_data_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:listSelector="@drawable/rowselector"
android:divider="@android:color/transparent" />
</LinearLayout>
</HorizontalScrollView>
</FrameLayout>
行选择器.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true"
android:drawable="@drawable/select_button_selectable" />
<!-- focused -->
<item android:state_focused="true" android:state_pressed="true"
android:drawable="@drawable/select_button_selectable" />
<!-- focused and pressed-->
<item android:state_pressed="true"
android:drawable="@drawable/select_button_selected" />
<!-- pressed -->
<item android:drawable="@drawable/select_button_selectable" />
<!-- default -->
</selector>
编辑:图像如下所示: Selected Rows but not Highlighted
【问题讨论】:
标签: android xml android-layout listview highlight