title: Focus on EditText in ListView when block descendants (Android)
body: <p>I have a customized <strong>ListView</strong>. Each row has an <code>EditText, Buttons &amp; TextView</code>. In order to make the ListView items clickable I have kept <code>android:descendantFocusability="blocksDescendants"</code> for row layout. If I don't keep the <strong>descendantFocusability</strong> I am not able to implement an action for <code>onItemClick</code>. If I keep <strong>descendantFocusability</strong> the <code>EditText</code>which is present in my row is not gaining focus. I want the <code>EditText</code> focusable and also I should be able to click on each row to navigate to another <code>Activity</code>. Can anyone please help me in this. Thanks all.</p>
  
  <p>Edit : In the CustomAdapter for EditText, I tried keeping <code>onTouchListener</code>and also <code>onClickListener</code>where I requestFocus but that does not seem to work.</p>
  
  <p>row.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/recentrowLayout"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:padding="@dimen/margin_left_5"
  android:clickable="true"
  tools:ignore="UseCompoundDrawables,HardcodedText,ContentDescription,UselessParent" &gt;
  
  &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:background="@drawable/edit_text_bg"
      android:padding="@dimen/margin_left_5" &gt;
  
      &lt;RelativeLayout
          android:id="@+id/rl1"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content" &gt;
  
          &lt;ImageView
              android:id="@+id/addSubscribe"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true" /&gt;
  
          &lt;TextView
              android:id="@+id/flikart_textview"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_centerInParent="true"
              android:text="FLIKART"
              android:textColor="@color/gray"
              android:textSize="@dimen/medium_text_size" /&gt;
  
          &lt;ImageView
              android:id="@+id/addToFav"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentRight="true" /&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;LinearLayout
          android:id="@+id/rl2"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/rl1"
          android:layout_marginLeft="@dimen/margin_30"
          android:layout_marginRight="@dimen/margin_30"
          android:layout_marginTop="10dp"
          android:gravity="center"
          android:orientation="vertical" &gt;
  
          &lt;TextView
              android:id="@+id/text_desciption"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_gravity="center_horizontal"
              android:gravity="center_horizontal"
              android:lines="2"
              android:text="20% off on Smart Phones and basic Handsets has upto 50% OFF only"
              android:textColor="@color/blue" /&gt;
  
          &lt;TextView
              android:id="@+id/text_desciption2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginTop="10dp"
              android:lines="1"
              android:text="somethign something,......."
              android:textColor="@color/gray" /&gt;
  
          &lt;TextView
              android:id="@+id/couponTypeText"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_marginTop="@dimen/margin_left_10"
              android:background="@drawable/button_bg"
              android:gravity="center"
              android:padding="@dimen/margin_left_10"
              android:text="STEAL THE DEAL"
              android:textColor="@color/white"
              android:textSize="@dimen/little_small_text_size" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;RelativeLayout
          android:id="@+id/rl3"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_below="@id/rl2"
          android:layout_marginTop="@dimen/margin_left_10" &gt;
  
          &lt;TextView
              android:id="@+id/text_offer_expiry"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentLeft="true"
              android:layout_centerVertical="true"
              android:layout_marginRight="@dimen/margin_left_5"
              android:text="Ends 10 days"
              android:textColor="@color/red"
              android:textSize="16sp" /&gt;
  
          &lt;RelativeLayout
              android:id="@+id/rightLayout"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignParentRight="true"
              android:layout_centerVertical="true"
              android:layout_marginRight="5dp" &gt;
  
              &lt;ImageView
                  android:id="@+id/comment_image_total"
                  android:layout_width="@dimen/dimenstion_25"
                  android:layout_height="@dimen/dimenstion_20"
                  android:background="@drawable/comments" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_comments"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerVertical="true"
                  android:layout_toRightOf="@id/comment_image_total"
                  android:text="100 Comments"
                  android:textColor="@color/gray"
                  android:textSize="16sp" /&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;RelativeLayout
              android:id="@+id/ll2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_centerVertical="true"
              android:layout_marginLeft="10dp"
              android:layout_marginRight="10dp"
              android:layout_toLeftOf="@id/rightLayout"
              android:layout_toRightOf="@id/text_offer_expiry"
              android:gravity="center_horizontal" &gt;
  
              &lt;ImageView
                  android:id="@+id/like_image_total"
                  android:layout_width="@dimen/dimenstion_25"
                  android:layout_height="@dimen/dimenstion_25"
                  android:background="@drawable/like" /&gt;
  
              &lt;TextView
                  android:id="@+id/text_total_likes"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerVertical="true"
                  android:layout_toRightOf="@id/like_image_total"
                  android:text="999 Likes"
                  android:textColor="@color/gray"
                  android:textSize="16sp" /&gt;
          &lt;/RelativeLayout&gt;
      &lt;/RelativeLayout&gt;
  
      &lt;View
          android:id="@+id/view"
          android:layout_width="fill_parent"
          android:layout_height="4dp"
          android:layout_below="@id/rl3"
          android:layout_marginTop="@dimen/margin_5"
          android:background="@color/purple_clor" /&gt;
  
      &lt;RelativeLayout
          android:layout_width="fill_parent"
          android:layout_height="@dimen/title_bar_height"
          android:layout_below="@id/view"
          android:layout_centerVertical="true"
          android:layout_marginTop="@dimen/margin_5" &gt;
  
          &lt;RelativeLayout
              android:id="@+id/likesLayout"
              android:layout_width="@dimen/dimenstion_40"
              android:layout_height="@dimen/dimenstion_40"
              android:layout_centerVertical="true"
              android:background="@drawable/unratedbkg" &gt;
  
              &lt;Button
                  android:id="@+id/likesBtn"
                  android:layout_width="@dimen/dimenstion_30"
                  android:layout_height="@dimen/dimenstion_30"
                  android:layout_centerInParent="true"
                  android:background="@drawable/unrated" /&gt;
          &lt;/RelativeLayout&gt;
  
          &lt;RelativeLayout
              android:id="@+id/footermain"
              android:layout_width="fill_parent"
              android:layout_height="@dimen/dimenstion_40"
              android:layout_centerVertical="true"
              android:layout_toRightOf="@id/likesLayout"
              android:background="@color/white" &gt;
  
              &lt;RelativeLayout
                  android:id="@+id/animLayout"
                  android:layout_width="100dp"
                  android:layout_height="@dimen/dimenstion_40"
                  android:layout_marginLeft="10dp"
                  android:layout_toRightOf="@id/likesLayout"
                  android:background="@drawable/ratingbkg"
                  android:visibility="gone" &gt;
  
                  &lt;RelativeLayout
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentLeft="true"
                      android:layout_margin="@dimen/margin_5" &gt;
  
                      &lt;ImageView
                          android:id="@+id/like_image"
                          android:layout_width="@dimen/dimenstion_30"
                          android:layout_height="@dimen/dimenstion_30"
                          android:layout_centerInParent="true"
                          android:background="@drawable/like" /&gt;
                  &lt;/RelativeLayout&gt;
  
                  &lt;RelativeLayout
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:layout_alignParentRight="true"
                      android:layout_margin="@dimen/margin_5" &gt;
  
                      &lt;ImageView
                          android:id="@+id/dislike_image"
                          android:layout_width="@dimen/dimenstion_30"
                          android:layout_height="@dimen/dimenstion_30"
                          android:layout_centerInParent="true"
                          android:background="@drawable/dislike" /&gt;
                  &lt;/RelativeLayout&gt;
              &lt;/RelativeLayout&gt;
  
              &lt;EditText
                  android:id="@+id/add_comment"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_centerVertical="true"
                  android:layout_marginLeft="5dp"
                  android:layout_toRightOf="@id/animLayout"
                  android:focusable="false"
                  android:focusableInTouchMode="false"
                  android:hint="Add Comment"
                  android:inputType="text" /&gt;
          &lt;/RelativeLayout&gt;
      &lt;/RelativeLayout&gt;
  &lt;/RelativeLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>