Skip to content

Instantly share code, notes, and snippets.

@javymarmol
Created May 10, 2018 15:26
Show Gist options
  • Save javymarmol/9a4a1f04a4afaccf7cc014813828b58b to your computer and use it in GitHub Desktop.
Save javymarmol/9a4a1f04a4afaccf7cc014813828b58b to your computer and use it in GitHub Desktop.
enable o disable view in android
public static void enableDisableView(View view, boolean enabled) {
view.setEnabled(enabled);
if ( view instanceof ViewGroup ) {
ViewGroup group = (ViewGroup)view;
for ( int idx = 0 ; idx < group.getChildCount() ; idx++ ) {
enableDisableView(group.getChildAt(idx), enabled);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment