I have a simple android radio button below
The code for this is: :
Thank you very much.
But the name of the button is hidden by a selection option, how do you delete it?
The last changes should be, I need to know at least which button I selected from three radio buttons …… is it possible to get the information below?
How can this problem be solved?
Decision No 1:
Add a background referring to an image or selector (as shown below) and make the button transparent:
If you want your radio buttons to have a different source when they are installed, make a drawing of the selection background :
In the selector above we refer to two drawings, a and b, so we make them:
res/drawable/a.xml – Status selected
res/drawable/b.xml – Normal condition
For more information about the drawings, click here: http://developer.android.com/guide/topics/resources/drawable-resource.html.
Decision No 2:
I’ve updated the answer and deleted the unnecessary items.
I created the XML for the following image.
Your XML code for RadioButton will be
radio_flat_selector.xml for the background selector:
radio_flat_selected.xml for the selected button:
radio_flat_regular.xml for normal selector:
The 3 above file codes are shown/hidden.
We now need a text color selector to adjust the text color accordingly.
radio_flat_text_selector.xml for text color selector
(Use the color/folder for this file).
Pay attention: I’ve found a lot of answers for this kind of solutions, but I haven’t found a good one, so I did it.
I hope this helps.
Thank you very much.
Decision No 3:
Use the same XML file format as in Evan’s answer, but a rendered file is all you need to format.
And your separate rendering file:
Decision No 4:
The configuration of the android: background and the android: button of RadioButton and the answer I got did not work for me. The rendered image is displayed in the background (although the android:-button is set to transparency) for the radio button text as image here.
android: button=@android: color/transparent
So he specified Radio Button as his style of tunable radio button.
and then the button worked with the custom button style.
Decision No 5:
You must enter the button attribute of the CompoundButton XML drawing path (my_checkbox) class.
For XML proofreading you must use :
Don’t forget to replace my_checkbox with your filename to draw, checkbox_not_checked with your PNG to draw, which is your checkbox if unchecked, and checkbox_checked with your picture if checked.
Update the layout settings for the format immediately.
Decision No 6:
To hide the standard radio button, I suggest removing it instead of making it transparent, as all visual feedback is processed in a rendered background:
It would also be preferable to use styles, as there are different radio buttons:
You also need a Seslyn CustomButtonBackground that you can draw.
Decision No 7:
The best way to add customizable renderings:
This removes overlapping shadows with a user-defined drawing.
Decision No 8:
An easy way to try
- Create a new layout in the rendered folder and call it custom_radiobutton (you can also rename it).
- Use it in your modeling.
Decision No 9:
Here’s an example of a custom radio button…
- xml file.
2.add a custom xml for the radio buttons
2.2.the woman is attractive
2.3. retractable man
is the output screen.
Decision No 10:
I understand that this answer is late, but when I look at developer.android.com, it seems that the shift key is perfect for your situation.
And of course you can always use other suggestions to draw the background to get the individual look you want.
Now if you want to continue finishing and have a halo effect around your buttons, you can use another custom selector to do just that.