0
私はMvvmCrossとXamarinを使用します。私のアプリでは、ネストされたMvxLinearLayoutを持つMvxListViewを持っています。どのようにしてLinearLayoutのアイテムのクリックを処理できますか?xamarin android:リスト内のリストで項目をクリック
これは私のコードです:
HTEリストビュー:
一覧
<MvxListView
android:id="@+id/category_list"
android:orientation="vertical"
android:choiceMode="singleChoice"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:listSelector="@drawable/list_item_selector"
local:MvxItemTemplate="@layout/listitem_inner_category_list"
local:MvxBind="ItemsSource Source" />
内側のリスト
<?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-auto"
android:layout_marginTop="20dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="3dp"
android:textAppearance="?android:attr/textAppearanceMedium"
local:MvxBind="Text Key" />
<Mvx.MvxLinearLayout
android:id="@+id/inner_category_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:clickable="true"
local:MvxItemTemplate="@layout/listitem_category"
local:MvxBind="ItemsSource .;ItemClick EditCommand" />
</LinearLayout>
アイテム:
<?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-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:layout_marginTop="4dp"
android:translationZ="3dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:gravity="fill_horizontal"
android:textAppearance="?android:attr/textAppearanceLarge"
local:MvxBind="Text Name" />
</LinearLayout>