Làm cách nào để giữ một mục, trong một MvxListView
, được đánh dấu cho đến khi nó được bỏ chọn hoặc cho đến khi một mục khác được chọn?Cách đánh dấu mục đã chọn trong một MvxListView
Chương trình của tôi có MvxListView
hiển thị chính xác danh sách các mục. Người dùng có thể chọn một mục, bằng cách nhấp vào nó, và sau đó nhấp vào nút lưu. Mục đã chọn được lưu trữ trong MyChosenItem
cho đến khi nó được cần bằng mã nút lưu. Hiện tại, mục đã chọn vẫn giữ nguyên phần nổi bật trong một giây sau khi quay lại màu chưa được chọn.
Đây là cách MvxListView
được tạo ra:
<Mvx.MvxListView
android:layout_width="match_parent"
android:layout_height="260dp"
android:layout_marginTop="40dp"
android:id="@+id/MyMvxListViewControl"
local:MvxBind="ItemsSource MyItems; SelectedItem MyChosenItem"
local:MvxItemTemplate="@layout/my_item_layout" />
Đây là Layout/my_item_layout.xaml
:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res/Project.Ui.Droid"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="300.0dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:textSize="20dp"
android:textColor="#000000"
local:MvxBind="Text Field1" />
<TextView
android:layout_width="250.0dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:textSize="20dp"
android:textColor="#000000"
local:MvxBind="Text Field2" />
</LinearLayout>
Liệu http://stackoverflow.com/questions/5058291/highlight-listview-selected-row giúp? – Stuart