Hi I want to disable all content of linear layout by when activity is loaded , when user click on that are , it display alert msg .
After click on activate button , linear layout should be enabled. Whether it is possible or not?
I am able to disable all content inside linear layout using following code:
LinearLayout myLayout = (LinearLayout) findViewById(R.id.linearLayout1);
for ( int i = 0; i < myLayout.getCount(); i++ ){
View view = myLayout.getChildAt(i);
view.setVisibility(View.GONE); // Or whatever you want to do with the view.
}
I want to display alert dialog when user click on disabled area.
please suggest me usable link or sample code.
Simply Use linearLayout. removeView(View view); It would refresh automaically.
We can use LinearLayout inside RelativeLayout. We can also use RelativeLayout as a Child of LinearLayout.
Convert a view or layoutClick the Design button in the top-right corner of the editor window. In the Component Tree, right-click the view or layout, and then click Convert view.... In the dialog that appears, choose the new type of view or layout, and then click Apply.
You need to do as follows:
LinearLayout myLayout = (LinearLayout) findViewById(R.id.linearLayout1);
for ( int i = 0; i < myLayout.getChildCount(); i++ ){
View view = myLayout.getChildAt(i);
view.setEnabled(false); // Or whatever you want to do with the view.
}
Then create an alert Dialog and then
myLayout.setOnclickListener(new OnClickListener(){
onClick(){
dialog.show();
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With