MvxExpandableListview第一项在重绘之前无法点击

时间:2017-03-15 13:10:47

标签: android xamarin xamarin.android mvvmcross

我有一个MvxExpandableListView,其中包含带有项目的MvxRecyclerView。 它可以正常显示,但是当我加载列表时,第一个MvxRecyclerView中的项目是不可点击的(并且它们也显示略有不同)。然后,当我向下滚动一点,以便项目不再可见并再次向上滚动时,我可以单击它们并显示所选项目。当我选择其中一个项目并返回后退按钮时,相同。

这里有什么问题?

代码:

的活动:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_frame"
    android:fitsSystemWindows="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <LinearLayout
        android:orientation="vertical"
        android:fitsSystemWindows="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <include
            layout="@layout/toolbar_actionbar" />
        <FrameLayout
            android:id="@+id/payment_list_balance_frame"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@android:color/transparent" />
        <Mvx.MvxExpandableListView
            android:id="@+id/expandable_payment_list"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            local:MvxGroupItemTemplate="@layout/header_payment_list"
            local:MvxItemTemplate="@layout/listitem_inner_payment_list"
            local:MvxBind="ItemsSource Source" />
    </LinearLayout>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:textAppearance="?android:attr/textAppearanceSmall"
        local:MvxBind="Visible IsPaymentsEmtpy"
        local:MvxLang="Text EmptyListPlaceholderLabel" />
    <com.github.clans.fab.FloatingActionMenu
        android:id="@+id/fab_menu_add_element"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|right"
        android:layout_margin="@dimen/fab_margin">
        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fab_add_income"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_income_white"
            local:fab_colorNormal="@color/colorPrimaryDark"
            local:fab_size="mini"
            local:fab_label="@string/fab_add_income"
            local:MvxBind="Click ViewActionViewModel.GoToAddIncomeCommand" />
        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fab_add_expense"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_expense_white"
            local:fab_colorNormal="@color/colorPrimaryDark"
            local:fab_size="mini"
            local:fab_label="@string/fab_add_expense"
            local:MvxBind="Click ViewActionViewModel.GoToAddExpenseCommand" />
        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fab_add_transfer"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_transfer_white"
            local:fab_colorNormal="@color/colorPrimaryDark"
            local:fab_size="mini"
            local:fab_label="@string/fab_add_transfer"
            local:MvxBind="Click ViewActionViewModel.GoToAddTransferCommand" />
        <com.github.clans.fab.FloatingActionButton
            android:id="@+id/fab_delete_account"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_delete"
            local:fab_colorNormal="@color/colorPrimaryDark"
            local:fab_size="mini"
            local:fab_label="@string/fab_delete_account"
            local:MvxBind="Click ViewActionViewModel.DeleteAccountCommand" />
    </com.github.clans.fab.FloatingActionMenu>
</android.support.design.widget.CoordinatorLayout>

带有标题的内部列表:

<?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="wrap_content">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="left"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="@color/gray"
        local:MvxBind="Text Key" />
    <MvvmCross.Droid.Support.V7.RecyclerView.MvxRecyclerView
        android:id="@+id/inner_payment_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:nestedScrollingEnabled="false"
        local:MvxItemTemplate="@layout/listitem_payment"
        local:MvxBind="ItemsSource .;ItemClick ItemClickCommand; ItemLongClick ItemLongClickCommand" />
</LinearLayout>

Recyclerview list item:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginLeft="3dp"
    android:layout_marginRight="3dp"
    android:layout_marginBottom="2dp"
    android:layout_marginTop="2dp">
  <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="3dp">
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="left"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/black"
            local:MvxBind="Text Category.Name" />
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="right"
            android:layout_alignParentTop="true"
            android:layout_alignParentBottom="true"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:textColor="@color/black"
            local:MvxBind="Text PaymentAmount(., ChargedAccount)" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="left"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_weight="0.9"
            local:MvxBind="Text Note" />
        <ImageView
            android:src="@drawable/ic_transfer"
            android:layout_gravity="right"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_weight="0.05"
            local:MvxBind="Visible IsTransfer" />
        <ImageView
            android:src="@drawable/ic_recurring"
            android:layout_gravity="right"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_weight="0.05"
            local:MvxBind="Visible IsRecurring" />
        <ImageView
            android:src="@drawable/ic_done_black"
            android:layout_gravity="right"
            android:layout_width="24dp"
            android:layout_height="24dp"
            android:layout_weight="0.05"
            local:MvxBind="Visible IsCleared" />
    </LinearLayout>
  </LinearLayout>
</android.support.v7.widget.CardView>

正如您在下面的屏幕截图中看到的,前两个项目没有相同的阴影。但在重绘之后,他们会这样做。

enter image description here

Github项目链接:https://github.com/MoneyFox/MoneyFox Github链接到MvxExpandableListView:https://github.com/MvvmCross/MvvmCross/blob/8a824c797747f74716fc64c2fd0e8765c29b16ab/MvvmCross/Binding/Droid/Views/MvxExpandableListView.cs

0 个答案:

没有答案