如何以编程方式进行布局可点击

时间:2021-04-19 15:00:51

I am creating a RelativeLayout programmatically, and thus, I need to add this xml attribute: android:clickable="true" programmatically.

我以编程方式创建RelativeLayout,因此,我需要以编程方式添加此xml属性:android:clickable =“true”。

How can this be done? thanks!

如何才能做到这一点?谢谢!

1 个解决方案

#1


8  

you have to use setClickable(true). See the docs

你必须使用setClickable(true)。查看文档

#1


8  

you have to use setClickable(true). See the docs

你必须使用setClickable(true)。查看文档