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.
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
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
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.
I have 10*3 buttons on my screen. When I click a button, I want it to be unvisible, so I do :
arg0.setVisibility(View.GONE);
But whenever the button is gone, the buttons change their size.
For example, if at the begining every button took 1/3 of a row, now when a button is gone the other buttons in the row get wider..
Is there a way to make them not change their size when a button is removed?
Use View.INVISIBLE. Using GONE makes it as if it wasn't there (so it no longer takes up space). Invisible just makes it disappear.
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)?