本文整理匯總了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);
}
}