Reputation: 498
I try to have a list that do different action with a button in the line item, and tap on the item list.
Here is the list
<Mvx.MvxListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/RecapResponsesListView"
local:MvxBind="ItemsSource ReponsesRecapList; ItemClick GoToLandscapeQuestion;"
local:MvxItemTemplate="@layout/item_response" />
Here is the item response :
[...]
<Button
android:id="@+id/ResponseValidate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="20"
android:layout_gravity="center"
android:gravity="center"
android:text="Valider"
local:MvxBind="Click ConfirmResponseCommand; Enabled ConfirmButtonEnabled" />
</LinearLayout>
My button works fine, I can tap on it without any problem, but since I added it, the ItemClick no longer works. I can remove my button from the item, and the ItemClick works again, so it's not the implementation of this tap that doesn't. I think adding a button block the item click...
Do you have any ideas on why, and how to fix this ??
Thanks !
Upvotes: 4
Views: 472
Reputation: 24460
This is not really a MvvmCross issue, but an issue with focus and how descendants receive touch events on Android.
You should be able to fix your issue by adding
android:descendantFocusability="blocksDescendants"
to the container with your button. Alternatively, if the button is not an ImageButton
it may be sufficient to simply add
android:focusable="false"
android:focusableInTouchMode="false"
to your button declaration.
Upvotes: 4