
我试图通过禁用包装relativeLayout来禁用子窗口小部件,但这不起作用,有没有其他方法可以做到这一点?我认为这是必要的,因为有时我们不希望在每个子窗口小部件上都使用setEnable(xx)。那么我能做到这一点吗?还是有类似的方式?非常感谢~
发布于 2013-01-02 22:56:17
也许你可以试试这样的方法:
RelativeLayout myLayout = (RelativeLayout findViewById(R.id.linearLayout1);
for ( int i = 0; i < myLayout.getCount(); i++ ){
View view = myLayout.getChildAt(i);
view.setEnabled(false); // Or whatever you want to do with the view.
}我相信你可以扩展layout类并实现一个新的方法来完成这项工作。此外,您还可以检查这个问题:How to disable all content inside linear layout in android?
https://stackoverflow.com/questions/14124061
复制相似问题