Android: How to propagate click event to LinearLayout childs and change their drawable

后端 未结 5 1737
灰色年华
灰色年华 2021-01-31 10:05

I would like to create a linear layout which would behave similarly to ImageButton.



        
5条回答
  •  有刺的猬
    2021-01-31 10:31

    Not only make for every child:

    android:duplicateParentState="true"
    

    But also additionally:

    android:clickable="false"  
    

    This will prevent unexpected behaviour (or solution simply not working) if clickable child views are used.

    SO Source

提交回复
热议问题