Android Layout make all children's not clickable

后端 未结 12 2204
一生所求
一生所求 2021-01-01 12:45

I am using Relative Layout and many buttons in it with TextViews etc.I want to make all of them not clickable unless some event happens.

12条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-01 13:25

    Since you are going to perform the click for some items in the layout when that particular function is executed,

    • You can keep a static flag like a boolean
    • Create a static boolean globally and declare it as false, once the particular function is performed change it to true.
    • so in all the onclick functions that u r performing check this flag if it is true perform the necessory function.

提交回复
热议问题