本文整理汇总了Java中android.widget.RadioGroup.getChildCount方法的典型用法代码示例。如果您正苦于以下问题:Java RadioGroup.getChildCount方法的具体用法?Java RadioGroup.getChildCount怎么用?Java RadioGroup.getChildCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.RadioGroup
的用法示例。
在下文中一共展示了RadioGroup.getChildCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setQuestion
import android.widget.RadioGroup; //导入方法依赖的package包/类
private void setQuestion(int n) {
// Get all questions array from strings resource
Resources res = getResources();
String[] questions = res.getStringArray(R.array.questions);
// Get possible answers array for current question from strings resource
int resIdAnswers =
res.getIdentifier("answers_for_question_" + (n + 1), "array", this.getPackageName());
answers = res.getStringArray(resIdAnswers);
// Get correct answers from strings resource
String[] correctAnswers = res.getStringArray(R.array.correct_answers_radiobuttons);
question = new Question(questions[n], answers, correctAnswers[n]);
// Set text of question
TextView questionTextView = (TextView) findViewById(R.id.text_question);
questionTextView.setText(questions[n]);
// Set text of answers radio buttons
radioGroup = (RadioGroup) findViewById(R.id.radio_group);
for (int i = 0; i < radioGroup.getChildCount(); i++) {
((RadioButton) radioGroup.getChildAt(i)).setText(answers[i]);
}
}
示例2: onCheckedChanged
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(RadioGroup radioGroup, int checkId) {
for (int i = 0; i < radioGroup.getChildCount(); i++) {
if (radioGroup.getChildAt(i).getId() == checkId) {
// 即将要展示的Fragment
Fragment target = mFragmentList.get(i);
Fragment currentFragment = getCurrentFragment();
currentFragment.onPause();
FragmentTransaction fragmentTransaction = getFragmentTransaction();
if (target.isAdded()) {
target.onResume();
fragmentTransaction.show(target).hide(currentFragment);
} else {
fragmentTransaction.add(mContentId, target).show(target).hide(currentFragment);
}
fragmentTransaction.commit();
currentTab = i;
if (mFragmentToogleListener != null) {
mFragmentToogleListener.onToogleChange(target, currentTab);
}
}
}
}
示例3: onCheckedChanged
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
for (int index = 0; index < radioGroup.getChildCount(); index++) {
setCheckedChildren(radioGroup, i);
}
}