Making a LinearLayout act like an Button

前端 未结 10 2090
无人及你
无人及你 2020-11-29 19:09

I have a LinearLayout that I\'ve styled to look like a button, and it contains a few text/ImageView elements. I would like to make the whole

10条回答
  •  鱼传尺愫
    2020-11-29 19:26

    I ran into this problem just now. You'll have to set the LinearLayout to clickable. You can either do this in the XML with

    android:clickable="true"
    

    Or in code with

    yourLinearLayout.setClickable(true);
    

    Cheers!

提交回复
热议问题