Wednesday, February 19, 2014

Android Radiogroup layout problem


Existing five radio buttons in a row horizontally, then a little crowded, I intend to display two rows, the first row of three, two second row, so I joined the two first layout RadioGroup, but increases it found that after several radio buttons instead of a group, and each of which can be selected, is there any solution to it, or in what way can make a radio button to wrap it?<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
"RadioButtons have to be direct children of RadioGroup", see here and here discussion.

Multiple RadioGroup, then put them together yourself, such as < / a>.
Reply:
Thank you, the problem is solved, I really do not understand why when running google plus other design layout group, and sad to say with
cited a floor panghuhu250 reply:
"RadioButtons have to be direct children of RadioGroup", see here and here for discussion.

Multiple RadioGroup, then put them together yourself, like this.

Reply:
How to solve?
Reply:

Solution according to the first floor of
reference to the third floor sky16h reply:
how to solve?

Reply:
The reply was deleted at the moderator 2012-02-28 14:14:55

Reply:
The method according to the first floor to be able to solve the newline problem, but can not the radio, and you can become a multiple choice
Reply:
Upstairs on the radio problem can not, in fact, there has also been a solution.
 
private OnCheckedChangeListener mOnCheckedChangeListener = new OnCheckedChangeListener () {

@ Override
public void onCheckedChanged (RadioGroup group, int checkedId) {
if (group == rg_skin_content1) {
rg_skin_content2.clearCheck ();
} Else if (group == rg_skin_content2) {
rg_skin_content1.clearCheck ();
}

}
};

Reply:
Sorry - not carefully read, this is the only solution
 
private OnCheckedChangeListener mOnCheckedChangeListener = new OnCheckedChangeListener () {

@ Override
public void onCheckedChanged (RadioGroup group, int checkedId) {
if (group! = null) {
if (group == rg_skin_content1) {
if (checkedId == R.id.rb_appearance_1 | | checkedId == R.id.rb_appearance_2 | | checkedId == R.id.rb_appearance_3 | | checkedId == R.id.rb_appearance_4) {

rg_skin_content2.clearCheck ();
group.check (checkedId);
}
} Else if (group == rg_skin_content2) {
if (checkedId == R.id.rb_appearance_5 | | checkedId == R.id.rb_appearance_6 | | checkedId == R.id.rb_appearance_7 | | checkedId == R.id.rb_appearance_8) {

rg_skin_content1.clearCheck ();
group.check (checkedId);
}
}

}
}
};

Reply:
Simply not feasible,
You call clearCheck
Will lead once again result in a call OnCheckedChangeListener
Then called again, the cycle call.
Must be wrong.
Reply:
reference to the 9th floor caryee89 reply:
simply not feasible,
You call clearCheck
Will lead once again result in a call OnCheckedChangeListener
Then called again, the cycle call.
Must be wrong.

Quote: references to the 8th floor generalx reply:

Indeed there will be an infinite loop, but RadioGroup value in the selected RadioButton is normal, then it is to be avoided in to add a logo
private Boolean changeGroup = false;
public void onCheckedChanged (RadioGroup group, int checkedId) {
if (group! = null && checkedId> -1 && changeGroup == false) {
if (group == frequencyGroup1) {
changeGroup = true;
frequencyGroup2.clearCheck ();
frequencyGroup3.clearCheck ();
changeGroup = false;
} Else if (group == frequencyGroup2) {
changeGroup = true;
frequencyGroup1.clearCheck ();
frequencyGroup3.clearCheck ();
changeGroup = false;
} Else if (group == frequencyGroup3) {
changeGroup = true;
frequencyGroup1.clearCheck ();
frequencyGroup2.clearCheck ();
changeGroup = false;
}
}
}

Reply:
reference to the 9th floor caryee89 reply:
simply not feasible,
You call clearCheck
Will lead once again result in a call OnCheckedChangeListener
Then called again, the cycle call.
Must be wrong.


Played microcontroller interrupt should all know it, go first OnCheckedChangeListener
Is set to NULL, and other operations over again like a set back
Reply:
Oh, already solved. . . Is that what you gravedigger?
Reply:
That is how do you solve it? Urgently needed!

No comments:

Post a Comment