android - RadioButton.setText() is not displaying the text -
I am creating radio boots and dynamically adding them to the radio group. But when I run the application, the text of the radiobutton is not showing on the screen.
This is my code for radiobutance
else if ((items.get (i) .ostosting (). Equals ("rade")) {radio group Bg = new radio group (getApplicationContext ()); Int baby = 0; For (int h = textlen; h & lt; text.size (); textlen ++) {if (text.get (textlen) contains ("(")) {s = text.get (textlen). Replace ("(", ""); if (s.contains (")")) s = s.replace (")", ""); } Else if (include text.get (textlen). (")")} {S = text.get (textlen) .replace (")", ""); } And s = text.get (textlen); RadioButton Radio Button = New Radio Button (getApplicationContext ()); Bg.addView (radiobutton); // / radioButton.setName ("RBT"); If (s.contains ("{on}")) // // radio button.setselected (true); RadioButton.setChecked (true); S = s.replace ("{on}", ""); } Other {radioButton.setChecked (wrong); S = s.replace ("{of}", ""); } // ((radio button) bg.getChildAt (child)) .set text (s); // Children ++; RadioButton.setText (s); String c = text.get (textlen) .substring (text.get (textlen). Length () - 1); If (C. angle (")")) {textlen ++; break; }} Layout.addView (BG); }
When I debug the code, I can see that the text is added to the radiographic children
but the text is not visible when running the application Anyone can find out this problem. Thanks alot
just add
setLayoutParams (parameter);
Both radio buttons as well as radio groups.
ou
android.widget.LinearLayout.LayoutParams params = New LinearLayout.LayoutParams (layoutproduct MATCH_PARENT, layout para. WRAP_CONTENT);
Comments
Post a Comment