I want to create a layout which has 5 button placed horizontally.
When I click on the button1 I need to show/hide three checkboxes under button1 and when I click on button2 I need to show/hide three EditText under button2 so on i.e. I need to show/hide different widgets under the button when a button is clicked.
Can any please tell me how to do this.
I apologize if my question is not clear. It is just like expanding and collapsing different views when a button is pressed.
What if I use include tag?
Thanks
Related
I have a horizontal scroll with set of buttons at the top part of the screen. I want buttons to appear below when one of the buttons above are clicked.
Button button1=new Button(context);
button1.setText("test");
button1.setId(id);
containerlayout.add(button1);
You Must place your buttons on top as well as bottom and then need to set visibility on basis of your click event
How to use radio buttons to decide which button any two buttons should appear where both buttons perform different task? In other words, if i change the radio button a button (normal button) should disappear and another button should take its place which performs another task.
You can use relative layout and place one button on top of the other, then set one of them visibility to "Gone" or "Invisible" when your activity starts or directly in the xml file. Finally add a onCheckedChangelistener to your radio button and change the visibility of the buttons as you need.
I have designed an UI with some 5-6 buttons and 2 galleries. On click of a button a listView is shown partially (does not cover the entire screen) from top right corner. I want to disable the onClick and scrolling of other buttons and galleries when the listView is visible.
That is I want to achieve a scenario similar to that of alertDialog. I don't want to individually disable the onClick of each button as I may need to add or remove buttons later and maintaining the code may become a tedious work. Is there any way to to disable the onClick and scrolling in general.
PS : It would also be helpful if the onClick and scrolling of a layout can be disabled. In that case I can disable the onClick of all layouts other than that of the listView that pops up
use this-
button.setEnabled(false);
or
button.setVisibility(View.INVISIBLE);
You can use viewgroup like this
and can disable the click event of that view group.
Is there a way to create a RadioGroup consisting of a few RadioButtons, such that the look of each RadioButton is like an ordinary Button rather than the default look (a checked circle beside some text)?
Is it necessary to fall back on a LinearLayout of Buttons and manually change the background of the buttons when handling button presses in a listener?
Edit: To be concrete, say we have two RadioButtons, foo and bar. When one is pressed, the string is displayed in boldface. The small circles that are normally next to each RadioButton is omitted. Is it necessary to manually make the change from and to boldface?
You can always put a custom look for you radio buttons, such as adding android:background=#drawable... and then setting a custom image for checked and unchecked state.
If i click on a button on one layout it should add text view in another layout dynamically again if i click that button same procedure should get repeat.
The question is not very easy to understand, do you mean activities instead of layouts? Or do you have a button in an activity and each time you press it, you want to have an additional text view on the same activity (for example below the button)?