当前位置: 首页>>代码示例>>Java>>正文


Java RadioGroup.getChildCount方法代码示例

本文整理汇总了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]);
        }
    }
 
开发者ID:PascalR2014,项目名称:Epilepsy_quiz,代码行数:28,代码来源:QuestionActivity.java

示例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);
            }

        }
    }

}
 
开发者ID:zuoni1018,项目名称:CoordinatorLayoutExample-master,代码行数:29,代码来源:ZhiHuAdapter.java

示例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);
    }
}
 
开发者ID:DSM-DMS,项目名称:DMS,代码行数:7,代码来源:DMSRadioGroup.java


注:本文中的android.widget.RadioGroup.getChildCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。