Monday, 28 April 2014

Android - Make layout clickable with its children

To make your layout clickable with its children you need add this option for every child

 android:clickable="false"   

Of course I am talking about only clickable state, not drawable state which is the another story.

 <LinearLayout  
      android:id="@+id/parent"  
      android:layout_width="match_parent"  
      android:layout_height="wrap_content"  
      android:orientation="horizontal">  
      <ImageButton  
           android:clickable="false"  
           android:layout_width="40dp"  
           android:layout_height="40dp"  
           android:text="Cinema"  
           android:textSize="13sp"  
           android:layout_marginRight="10dp" />  
      <Button  
           android:clickable="false"  
           android:layout_width="match_parent"  
           android:layout_height="40dp"  
           android:text="Check in"  
           android:textSize="13sp" />  
 </LinearLayout>