I'm using ChipView in android.
I've added HorizontalScrollView to chips_recipient_dropdown_item.xml file.
but now the onItemClick event is not fired of the class RecipientEditTextView.java
RecipientEditTextView.java
/**
* When an item in the suggestions list has been clicked, create a chip from the
* contact information of the selected item.
*/
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position < 0) {
return;
}
submitItemAtPosition(position);
if (itemSelectedListener != null) {
itemSelectedListener.onItemSelected();
}
}
chips_recipient_dropdown_item.xml (With HorizontalScrollView):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?android:attr/activatedBackgroundIndicator"
android:descendantFocusability="blocksDescendants"
android:gravity="center_vertical"
android:minHeight="56dip"
android:orientation="horizontal">
<ImageView
android:id="@android:id/icon"
style="@style/ChipIconStyle"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:cropToPadding="true"
android:scaleType="centerCrop"
android:src="@drawable/ic_contact_picture" />
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbarSize="0dp">
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingTop="8dp"
android:paddingRight="10dp"
android:paddingBottom="8dp">
<TextView
android:id="@android:id/title"
style="@style/ChipTitleStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".87"
android:ellipsize="end"
android:singleLine="true"
android:textSize="16sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@android:id/text1"
style="@style/ChipSubtitleStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".54"
android:ellipsize="end"
android:singleLine="true"
android:textSize="14sp" />
<TextView
android:id="@android:id/text2"
style="@style/ChipSubtitleStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha=".54"
android:ellipsize="end"
android:paddingLeft="10dp"
android:singleLine="true"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
I've added android:descendantFocusability="blocksDescendants"to the topmost root layout (ListView with horizontalScrollView OnItemClick not working) , so it's working only on ImageView but not working with LinearLayout inside HorizontolScrollView.
I also tried android:clickable="false" android:focusable="false" android:focusableInTouchMode="false" to HorizontalScrollView but nothing works.
Can anyone please suggest to me How can I solve this?
Thanks in Advance.