I want to have EditText
within the MvxListView
that has ItemLongClick
binding working normally in it (using template). The development framework that I used is MvvmCross
within Xamarin.Android (written in C#
).
I have tried the normal approach, and the EditText
seems taking all of the focusable within the MvxListView
item. It means, the ItemLongClick
only works within the EditText
part of the item. It is important to know when I disable the focusable of EditText
(android:focusable="false"
), the ItemLongClick
works within all part of the item (in sacrifice of EditText
not working). The last thing that I have tried is set android:descendantFocusability="blocksDescendants"
on my root element (based on this answer) of my item layout and it acts the same as disabling the EditText
focusable.
Below is the code I wrote.
MvxListView in .axml
...
<Mvx.MvxListView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
local:MvxItemTemplate="@layout/table_shipment_item_layout"
android:divider="#BCBCBC"
android:dividerHeight="1dp"
android:descendantFocusability="afterDescendants"
android:focusable="false"
local:MvxBind="ItemsSource ScannedItems; ItemLongClick RemoveItemCommand;" />
...
table_shipment_item_layout.axml
<?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="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/custom_clickable_item">
...
<EditText
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textSize="16.0dp"
android:text="5"
android:padding="8.0dp"
android:maxLines="1"
android:singleLine="true"
android:textColor="#000000"
android:textColorHint="#D3D3D3"
android:background="@drawable/custom_textbox"
android:inputType="number|numberDecimal"
android:digits="0123456789."
android:layout_gravity="right|center_vertical"
local:MvxBind="Text Quantity;" />
</LinearLayout>
As you can see, I am using the EditText
, so users are able to edit the quantity of every scanned item. Is there any workaround for this? I am also open to another method aside from EditText
within MvxListView
if there is any. Thanks in advance.