2

In android if I have a linear layout object, and it has a bunch of stuff inside it like textviews, more linear layouts which contain more linear layouts. How can you just disable (.setEnabled(false);) everything in that given linear layout?

Thanks

omega
  • 35,693
  • 74
  • 215
  • 425

2 Answers2

1

Something like that:

for(int i = 0; i < ((LinearLayout) YourLinearLayout).getChildCount(); i++){
  ((View)((LinearLayout) YourLinearLayout).getChildAt(i)).setEnabled(false);
}
Boris Mocialov
  • 3,319
  • 2
  • 25
  • 53
0

Check this:

How to disable/enable all children on LinearLayout in Android

Community
  • 1
  • 1
Hossam Oukli
  • 1,247
  • 3
  • 19
  • 40
  • But this removes the view from the screen, I want to use `.setEnabled(false)` method, so it makes it unusable and grayed out. – omega Aug 03 '13 at 21:01