當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。