2016-11-26 8 views
0

Я использую MvvmCross и Xamarin. В моем приложении у меня есть MvxListView с вложенным MvxLinearLayout. Как я могу обработать щелчок по элементу 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> 

ответ

0

Я использовал это во внутреннем списке:

<MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerView 
     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 ItemClickCommand" /> 

Он seemes, что на MvxLinearLayout нет ItemClick не реализован :)

 Смежные вопросы

  • Нет связанных вопросов^_^