I have a problem with my ListView. ListView row contains: TextView field, EditText field and Image field but focused only on EditText field. If I write in Layout attributes android:descendantFocusability="blocksDescendants"
then ListView row becomes focusable, but EditText field becomes not focusable. What should I do to get focusable ListView row and EditText field in this row?
Here is the example of my MainActivity layout with ListView and ListView row layout.
MainActivity:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:text="@string/button_select_folder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/button_select_folder"
android:layout_gravity="center_horizontal"
android:layout_marginTop="13dp" >
</Button>
<ListView
android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
</ListView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:visibility="gone"
android:layout_marginTop="10dp"
android:id="@+id/tvPathToPL"
android:text="@string/tvPathToPL"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:id="@+id/btnPathToPL"
android:text="@string/btnPathToPL"
android:visibility="gone"/>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:visibility="invisible"
android:id="@+id/tlPLName">
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tvPLName"
android:text="@string/tvPLName"/>
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/etPLName"
android:inputType="textCapWords"
android:hint="@string/etPLName"/>
</TableRow>
</TableLayout>
<Button
android:text="@string/generate_playlist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/generate"
android:layout_gravity="center_horizontal"
android:visibility="invisible"
android:layout_weight="0">
</Button>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:id="@+id/ExitApp"
android:text="@string/ExitApp"
android:layout_gravity="center_horizontal">
</Button>
</LinearLayout>
ListView row:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
<!-- android:descendantFocusability="blocksDescendants -->
android:orientation="horizontal">
<LinearLayout
android:id="@+id/LL_Option"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/OptionDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text=""
android:textSize="20sp">
</TextView>
</LinearLayout>
<EditText
android:id="@+id/OptionSongCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:hint="1"
android:clickable="true"
android:textSize="20sp"
android:layout_marginTop="5dp"/>
<ImageView
android:id="@+id/OptionImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher">
</ImageView>
</LinearLayout>
Will be very thankful for help.