类android.widget.RadioGroup源码实例Demo

下面列出了怎么用android.widget.RadioGroup的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: talkback   文件: SetupWizardStepSpeedFragment.java
@Override
protected void updateScreenForCurrentPreferenceValues(View view) {
  RadioGroup scanningMethodRadioGroup = view.findViewById(R.id.autoscan_speeds_radio_group);
  double autoScanDelay = SwitchAccessPreferenceUtils.getAutoScanDelaySeconds(getActivity());
  if (autoScanDelay
      == Double.parseDouble(getString(R.string.pref_auto_scan_time_delay_fast_value))) {
    scanningMethodRadioGroup.check(R.id.fast_speed_radio_button);
  } else if (autoScanDelay
      == Double.parseDouble(getString(R.string.pref_auto_scan_time_delay_medium_value))) {
    scanningMethodRadioGroup.check(R.id.medium_speed_radio_button);
  } else if (autoScanDelay
      == Double.parseDouble(getString(R.string.pref_auto_scan_time_delay_slow_value))) {
    scanningMethodRadioGroup.check(R.id.slow_speed_radio_button);
  } else {
    scanningMethodRadioGroup.check(R.id.custom_speed_radio_button);
    EditText editText = view.findViewById(R.id.custom_speed_edit_text);
    editText.setText(Double.toString(autoScanDelay));
  }
}
 
源代码2 项目: Camdroid   文件: ColorSpaceProcessor.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View v = super
            .onCreateView(inflater, container, savedInstanceState);

    RadioGroup colorspace = (RadioGroup) v.findViewById(R.id.colorspace);
    colorspace.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            channel = checkedId;
        }
    });

    ((RadioButton) v.findViewById(channel)).setChecked(true);

    return v;
}
 
源代码3 项目: AndroidRipper   文件: ReflectionExtractor.java
/**
 * Detect Name of the Widget
 * 
 * @param v
 *            Widget
 * @return
 */
protected String detectName(View v) {
	String name = "";
	if (v instanceof TextView) {
		TextView t = (TextView) v;
		name = (t.getText() != null) ? t.getText().toString() : "";
		if (v instanceof EditText) {
			CharSequence hint = ((EditText) v).getHint();
			name = (hint == null) ? "" : hint.toString();
		}
	} else if (v instanceof RadioGroup) {
		RadioGroup g = (RadioGroup) v;
		int max = g.getChildCount();
		String text = "";
		for (int i = 0; i < max; i++) {
			View c = g.getChildAt(i);
			text = detectName(c);
			if (!text.equals("")) {
				name = text;
				break;
			}
		}
	}
	return name;
}
 
源代码4 项目: WifiChat   文件: SettingInfoActivity.java
@Override
protected void initViews() {

    mIvAvater = (ImageView) findViewById(R.id.setting_my_avater_img);
    mEtNickname = (EditText) findViewById(R.id.setting_my_nickname);
    mRgGender = (RadioGroup) findViewById(R.id.setting_baseinfo_rg_gender);
    mHtvConstellation = (TextView) findViewById(R.id.setting_birthday_htv_constellation);
    mHtvAge = (TextView) findViewById(R.id.setting_birthday_htv_age);
    mDpBirthday = (DatePicker) findViewById(R.id.setting_birthday_dp_birthday);

    mRbBoy = (RadioButton) findViewById(R.id.setting_baseinfo_rb_male);
    mRbGirl = (RadioButton) findViewById(R.id.setting_baseinfo_rb_female);

    mBtnBack = (Button) findViewById(R.id.setting_btn_back);
    mBtnNext = (Button) findViewById(R.id.setting_btn_next);

}
 
源代码5 项目: KSYMediaPlayer_Android   文件: SettingActivity.java
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
    if(i==R.id.use_hw){
        editor.putString("choose_decode", Settings.USEHARD);
    }else if(i==R.id.use_sw){
        editor.putString("choose_decode", Settings.USESOFT);
    }else if(i==R.id.type_vod){
        editor.putString("choose_type", Settings.VOD);
    }else if(i==R.id.type_live){
        editor.putString("choose_type", Settings.LIVE);
    }else if(i==R.id.type_floating){
        editor.putString("choose_type", Settings.FLOATING);
    }else if(i==R.id.type_media_player){
        editor.putString("choose_type", Settings.MEDIA_PLAYER);
    }
    editor.commit();
}
 
源代码6 项目: JNChartDemo   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    RadioGroup navigation = (RadioGroup) findViewById(R.id.navigation);
    if (navigation != null) {
        navigation.setOnCheckedChangeListener(this);
    }

    btn1 = (RadioButton) findViewById(R.id.fragment1);
    btn2 = (RadioButton) findViewById(R.id.fragment2);
    btn3 = (RadioButton) findViewById(R.id.fragment3);
    btn4 = (RadioButton) findViewById(R.id.fragment4);

    fragment1 = new Fragment1();
    fragment2 = new Fragment2();
    fragment3 = new Fragment3();
    fragment4 = new Fragment4();

    getSupportFragmentManager().beginTransaction().add(R.id.home_container, fragment1).commit();
    mContent = fragment1;


}
 
源代码7 项目: codeexamples-android   文件: TestActivity.java
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
	if (BuildConfig.DEBUG) {
		Log.e(Constants.LOG, "onCreate called");
	}
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);
	RadioGroup group1 = (RadioGroup) findViewById(R.id.orientation);
	group1.setOnCheckedChangeListener(new OnCheckedChangeListener() {
		@Override
		public void onCheckedChanged(RadioGroup group, int checkedId) {
			switch (checkedId) {
			case R.id.horizontal:
				group.setOrientation(LinearLayout.HORIZONTAL);
				break;
			case R.id.vertical:
				group.setOrientation(LinearLayout.VERTICAL);
				break;
			}
		}
	});

}
 
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    if (polyline == null) {
        return;
    }

    int groupId = group.getId();
    if (groupId == R.id.start_cap_radio) {
        Cap startCap = radioIdToStartCap.get(checkedId);
        if (startCap != null) {
            polyline.setStartCap(startCap);
        }
    } else if (groupId == R.id.end_cap_radio) {
        Cap endCap = radioIdToEndCap.get(checkedId);
        if (endCap != null) {
            polyline.setEndCap(endCap);
        }
    }
}
 
源代码9 项目: TraceByAmap   文件: UiSettingsActivity.java
/**
 * 初始化AMap对象
 */
private void init() {
	if (aMap == null) {
		aMap = mapView.getMap();
		mUiSettings = aMap.getUiSettings();
	}
	Button buttonScale = (Button) findViewById(R.id.buttonScale);
	buttonScale.setOnClickListener(this);
	CheckBox scaleToggle = (CheckBox) findViewById(R.id.scale_toggle);
	scaleToggle.setOnClickListener(this);
	CheckBox zoomToggle = (CheckBox) findViewById(R.id.zoom_toggle);
	zoomToggle.setOnClickListener(this);
	zoomRadioGroup = (RadioGroup) findViewById(R.id.zoom_position);
	zoomRadioGroup.setOnCheckedChangeListener(this);
	CheckBox compassToggle = (CheckBox) findViewById(R.id.compass_toggle);
	compassToggle.setOnClickListener(this);
	CheckBox mylocationToggle = (CheckBox) findViewById(R.id.mylocation_toggle);
	mylocationToggle.setOnClickListener(this);

}
 
源代码10 项目: Car-Pooling   文件: SearchActivity.java
/**
 * This method is used to select ride that are available to specific destination in the form of radio buttons
 */
private void displayConfirmation(){

    RadioGroup radioGroup= (RadioGroup) findViewById(R.id.RadioButtonGroup);
    if(radioGroup.getChildCount()>0) {
        RadioButton radioButton = (RadioButton) findViewById(radioGroup.getCheckedRadioButtonId());
        String selectedtext = radioButton.getText().toString();
        Toast.makeText(SearchActivity.this, selectedtext, Toast.LENGTH_SHORT).show();

        //Toast.makeText(SearchActivity.this, text[5], Toast.LENGTH_SHORT).show();
        Intent myIntent = new Intent(this, RideConfirmation.class);
        myIntent.putExtra("RideDetails",selectedtext);
        myIntent.putExtra("PickupLocation",address);
        startActivityForResult(myIntent, 0);
        finish();

    }
    else
    {
        Toast.makeText(SearchActivity.this, "No Rides available to book.. Please try again", Toast.LENGTH_SHORT).show();
    }

}
 
源代码11 项目: BlogDemo   文件: AsymmetricEncryptActivity.java
private void bindEvent() {
    ((TextView) findViewById(R.id.tv_title_bar_title)).setText(R.string.crypto_title_asymmetric);
    findViewById(R.id.iv_title_bar_back).setOnClickListener(this);
    mEtPublicKey = findViewById(R.id.et_crypto_public_key);
    mEtPrivateKey = findViewById(R.id.et_crypto_private_key);
    mEtData = findViewById(R.id.et_crypto_data);
    mEtResult = findViewById(R.id.et_crypto_result);
    findViewById(R.id.btn_crypto_rsa_encrypt).setOnClickListener(this);
    findViewById(R.id.btn_crypto_rsa_decrypt).setOnClickListener(this);
    ((RadioGroup) findViewById(R.id.rg_crypto_output_mode)).setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            mOutputModeCheckedId = checkedId;
        }
    });
}
 
源代码12 项目: cameraMediaCodec   文件: HelloCameraActivity.java
public void onCheckedChanged(RadioGroup group, int checkedId) {
	// TODO Auto-generated method stub
	switch (checkedId)
	{
	case R.id.RadioButton_surfaceview:
		Log.i(log_tag, "[Radio] RadioButton_surfaceview");
		mUseSurfaceTexture = false;
		break;
	case R.id.radioButton_surfacetexture:
		Log.i(log_tag, "[Radio] radioButton_surfacetexture");
		mUseSurfaceTexture = true;
		break;
	case R.id.RadioButton_AllocPB:
		Log.i(log_tag, "[Radio] RadioButton_AllocPB");
		mUsePreviewBuffer = true;
		break;
	case R.id.radioButton_NotAllocPB:
		Log.i(log_tag, "[Radio] radioButton_NotAllocPB");
		mUsePreviewBuffer = false;
		break;
	}
	
}
 
源代码13 项目: BmapLite   文件: SettingActivity.java
@Override
public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
    ConfigInteracter interacter = new ConfigInteracter(this);
    if (group.getId() == R.id.group_zoom) {
        if (checkedId == R.id.radio_zoom_left) {
            interacter.setZoomControlsPosition(false);
        } else if (checkedId == R.id.radio_zoom_right) {
            interacter.setZoomControlsPosition(true);
        }
    } else if (group.getId() == R.id.group_mode) {
        if (checkedId == R.id.radio_white) {
            interacter.setNightMode(1);
        } else if (checkedId == R.id.radio_black) {
            if (BApp.TYPE_MAP == TypeMap.TYPE_BAIDU) {
                Toast.makeText(this, "夜间模式下百度地图可能需要重启应用后生效", Toast.LENGTH_LONG).show();
            }
            interacter.setNightMode(2);
        } else {
            interacter.setNightMode(0);
        }
        ((BApp) getApplication()).setNightMode();
    }

}
 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main2);

    mRecyclerView = (RecyclerView) findViewById(R.id.alphaList);
    mLayoutManager = new LinearLayoutManager(this);
    mRecyclerView.setLayoutManager(mLayoutManager);

    mAdapter = new ClickableFruitAdapter(FruitData.getList1(), this);
    mRecyclerView.setAdapter(mAdapter);

    for (FruitData d : FruitData.getList2()) {
        mExtraFruits.add(d);
    }

    RadioGroup opGroup = (RadioGroup) findViewById(R.id.opGroup);
    opGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup radioGroup, int i) {
            mMode = i;
        }
    });

}
 
源代码15 项目: AndroidWearable-Samples   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addApi(Wearable.API)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();
    mFutureQuestions = new PriorityQueue<Question>(10);

    // Find UI components to be used later.
    questionEditText = (EditText) findViewById(R.id.question_text);
    choiceAEditText = (EditText) findViewById(R.id.choice_a_text);
    choiceBEditText = (EditText) findViewById(R.id.choice_b_text);
    choiceCEditText = (EditText) findViewById(R.id.choice_c_text);
    choiceDEditText = (EditText) findViewById(R.id.choice_d_text);
    choicesRadioGroup = (RadioGroup) findViewById(R.id.choices_radio_group);
    quizStatus = (TextView) findViewById(R.id.quiz_status);
    quizButtons = (LinearLayout) findViewById(R.id.quiz_buttons);
    questionsContainer = (LinearLayout) findViewById(R.id.questions_container);
    readQuizFromFileButton = (Button) findViewById(R.id.read_quiz_from_file_button);
    resetQuizButton = (Button) findViewById(R.id.reset_quiz_button);
}
 
源代码16 项目: ProjectX   文件: WrapLayoutActivity.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setSupportActionBar(R.id.wl_toolbar);
    mVContent = findViewById(R.id.wl_wl_content);
    final RadioGroup gravity = findViewById(R.id.wl_rg_gravity);
    final SeekBar horizontal = findViewById(R.id.wl_sb_horizontal);
    final SeekBar vertical = findViewById(R.id.wl_sb_vertical);

    gravity.setOnCheckedChangeListener(this);
    gravity.check(R.id.wl_rb_top);
    horizontal.setOnSeekBarChangeListener(this);
    horizontal.setProgress(15);
    vertical.setOnSeekBarChangeListener(this);
    vertical.setProgress(15);
}
 
源代码17 项目: file-downloader   文件: AdvancedUseActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.advanced_use__activity_advanced_use);

    // init fragments
    List<Fragment> pagerFragments = new ArrayList<Fragment>();
    Fragment fragment1 = CoursePreviewFragment.newInstance();
    pagerFragments.add(fragment1);
    Fragment fragment2 = CourseDownloadFragment.newInstance();
    pagerFragments.add(fragment2);

    mFragmentActionTabPager = new FragmentActionTabPager(getSupportFragmentManager(), pagerFragments);

    RadioGroup rgActionTab = (RadioGroup) findViewById(R.id.rgActionTab);
    ActionTabViewPager avPagerContainer = (ActionTabViewPager) findViewById(R.id.atViewPager);
    mFragmentActionTabPager.setup(rgActionTab, avPagerContainer, true, false);
}
 
源代码18 项目: AndroidRipper   文件: SimpleExtractor.java
/**
 * Detect Name of the Widget
 * 
 * @param v
 *            Widget
 * @return
 */
protected String detectName(View v) {
	String name = "";
	if (v instanceof TextView) {
		TextView t = (TextView) v;
		name = (t.getText() != null) ? t.getText().toString() : "";
		if (v instanceof EditText) {
			CharSequence hint = ((EditText) v).getHint();
			name = (hint == null) ? "" : hint.toString();
		}
	} else if (v instanceof RadioGroup) {
		RadioGroup g = (RadioGroup) v;
		int max = g.getChildCount();
		String text = "";
		for (int i = 0; i < max; i++) {
			View c = g.getChildAt(i);
			text = detectName(c);
			if (!text.equals("")) {
				name = text;
				break;
			}
		}
	}
	return name;
}
 
源代码19 项目: bither-android   文件: MarketDetailActivity.java
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    switch (checkedId) {
        case R.id.rb_one_minute:
            loadKlineData(KlineTimeType.ONE_MINUTE);
            break;
        case R.id.rb_five_minute:
            loadKlineData(KlineTimeType.FIVE_MINUTES);
            break;
        case R.id.rb_one_hour:
            loadKlineData(KlineTimeType.ONE_HOUR);
            break;
        case R.id.rb_one_day:
            loadKlineData(KlineTimeType.ONE_DAY);
            break;
        default:
            break;
    }
}
 
源代码20 项目: LaunchTime   文件: BackupActivity.java
private RadioButton makeRadioButton(RadioGroup baks, final String bk, final boolean item) {
    RadioButton bkb = new RadioButton(this);
    bkb.setText(bk);


    bkb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            if (b) {
                selectedBackup = bk;
                selected = item;
                Log.d("backuppage", "selected = " + selectedBackup);
                backupSelected(selected);
            }
        }
    });

    baks.addView(bkb);
    return bkb;
}
 
源代码21 项目: android-discourse   文件: MainActivity.java
protected void siteChanged(RadioGroup group, int checkedId) {
    if (checkedId == -1) {
        return;
    }
    RadioButton button = (RadioButton) group.findViewById(checkedId);
    Site site = (Site) button.getTag();
    if (site != null) {
        App.setSiteUrl(site.getUrl());
    }
    if (site == null) {
        group.clearCheck();
        openSettingsActivity();
    } else if (!site.getUrl().equals(mCurrentSiteUrl)) { // TODO 第一次启动 加载上次查看的url。
        mDrawerPosition = ListView.INVALID_POSITION;
        mCurrentSite = site;
        mCurrentSiteUrl = site.getUrl();
        PrefsUtils.setCurrentSiteUrl(mCurrentSiteUrl);
        App.setLogin(false);
        clearDatabase();
        // 登陆完成后,再加载其他信息
        loadUserInfo(site, false);
    } else {
        setupUserInfo(mUser);
    }
    getActionBar().setSubtitle(mCurrentSiteUrl);
}
 
源代码22 项目: ngAndroid   文件: NgChange.java
@Override
public void attach(Scope scope, View view, int layoutId, int viewId, Tuple<String, String>[] models){
    Executor executor = new Executor(scope, layoutId, viewId, getAttribute());
    if(view instanceof CompoundButton){
        CompoundButton button = (CompoundButton) view;
        button.setOnCheckedChangeListener(executor);
    }else if(view instanceof TextView){
        TextView textView = (TextView) view;
        textView.addTextChangedListener(executor);
    }else if(view instanceof Spinner){
        Spinner spinner = (Spinner) view;
        spinner.setOnItemSelectedListener(executor);
    }else if(view instanceof RadioGroup){
        RadioGroup group = (RadioGroup) view;
        group.setOnCheckedChangeListener(executor);
    }
}
 
源代码23 项目: WindView   文件: MainActivity.java
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
    switch (radioGroup.getCheckedRadioButtonId()) {
        case R.id.rv_up:
            windView.setTrendType(TrendType.UP);
            windView.start();
            break;
        case R.id.rv_down:
            windView.setTrendType(TrendType.DOWN);
            windView.start();
            break;
        case R.id.rv_none:
            windView.setTrendType(TrendType.NONE);
            windView.start();
            break;
    }

}
 
源代码24 项目: AssistantBySDK   文件: AlarmItemDialog.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dialog_alarm_item);
    ButterKnife.bind(this);
    fillMap();
    mAlarmItemBtns.check(itemMaps.get(mAlarmItem));
    mAlarmItemBtns.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            RadioButton selectedBtn = (RadioButton) findViewById(checkedId);
            mAlarmItem = selectedBtn.getText().toString();
            if (mSelectedListener != null)
                mSelectedListener.onSelected(mAlarmItem);
            dismiss();
        }
    });
}
 
源代码25 项目: LaunchTime   文件: BackupActivity.java
private void populateBackupsList() {
    backupsLayout.removeAllViews();
    RadioGroup baks = new RadioGroup(this);

    makeRadioButton(baks, getString(R.string.no_backup_selected), false).setChecked(true);

    for(final String bk: db().listBackups()) {

        makeRadioButton(baks, bk, true);
    }
    backupsLayout.addView(baks);
}
 
源代码26 项目: prayer-times-android   文件: LanguageFragment.java
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.intro_language, container, false);
    RadioGroup radioGroup = v.findViewById(R.id.radioGroup);
    
    List<LocaleUtils.Translation> langs = LocaleUtils.getSupportedLanguages(getActivity());
    String currentLang = Preferences.LANGUAGE.get();
    int pos = 0;
    for (int i = 0; i < langs.size(); i++) {
        LocaleUtils.Translation lang = langs.get(i);
        if (lang.getLanguage().equals(currentLang))
            pos = i + 1;
        RadioButton button = new RadioButton(getContext());
        button.setTag(lang.getLanguage());
        button.setText(lang.getDisplayText());
        button.setTextColor(getResources().getColor(R.color.white));
        button.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
        int padding = (int) (button.getTextSize() / 2);
        button.setPadding(padding, padding, padding, padding);
        button.setOnCheckedChangeListener(this);
        radioGroup.addView(button);
    }
    if (pos != 0)
        ((RadioButton) radioGroup.getChildAt(pos)).setChecked(true);
    return v;
}
 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.cloudpage_inbox_layout);

    if (getSupportActionBar() != null) {
        getSupportActionBar().setHomeButtonEnabled(true);
        getSupportActionBar().setTitle(getResources().getString(R.string.app_name));
    }

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    RadioGroup filterRadioGroup;
    final ListView cloudPageListView;

    filterRadioGroup = findViewById(R.id.filterRadioGroup);
    cloudPageListView = findViewById(R.id.cloudPageListView);

    filterRadioGroup.setOnCheckedChangeListener(radioChangedListener);

    cloudPageListView.setOnItemClickListener(cloudPageItemClickListener);
    cloudPageListView.setOnItemLongClickListener(cloudPageItemDeleteListener);

    MarketingCloudSdk.requestSdk(new MarketingCloudSdk.WhenReadyListener() {
        @Override
        public void ready(@NonNull MarketingCloudSdk marketingCloudSdk) {
            marketingCloudSdk.getAnalyticsManager().trackPageView("data://CloudPageInbox", "Cloud Page Inbox index view displayed", null, null);
            cloudPageListAdapter = new MyCloudPageListAdapter(marketingCloudSdk);
            cloudPageListView.setAdapter(cloudPageListAdapter);
        }
    });

}
 
@Override
protected void updateScreenForCurrentPreferenceValues(View view) {
  RadioGroup scanningMethodRadioGroup = view.findViewById(R.id.scanning_options_radio_group);
  String scanningMethod = SwitchAccessPreferenceUtils.getCurrentScanningMethod(getActivity());
  if (scanningMethod.equals(getString(R.string.linear_scanning_key))) {
    scanningMethodRadioGroup.check(R.id.linear_scanning_radio_button);
  } else if (scanningMethod.equals(getString(R.string.views_linear_ime_row_col_key))) {
    scanningMethodRadioGroup.check(R.id.linear_scanning_except_keyboard_radio_button);
  } else if (scanningMethod.equals(getString(R.string.row_col_scanning_key))) {
    scanningMethodRadioGroup.check(R.id.row_column_scanning_radio_button);
  } else if (scanningMethod.equals(getString(R.string.group_selection_key))) {
    scanningMethodRadioGroup.check(R.id.group_selection_radio_button);
  }
}
 
源代码29 项目: YImagePicker   文件: MainActivityView.java
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
    if (checkedId == mRbRedBook.getId()) {
        mCbClosePreview.setEnabled(false);
        mCbImageOrVideo.setEnabled(false);
        mRbNew.setEnabled(false);
        mRbShield.setEnabled(false);
        mRbSave.setEnabled(false);
        mRbCrop.setEnabled(false);
        mCbShowOriginal.setEnabled(false);
        mRbMulti.setChecked(true);
    } else if (checkedId == mRbWeChat.getId()) {
        mCbClosePreview.setEnabled(true);
        mCbImageOrVideo.setEnabled(true);
        mRgNextPickType.setEnabled(true);
        mRbCrop.setEnabled(true);
        mCbShowOriginal.setEnabled(true);
        mRbMulti.setChecked(true);
        mRbNew.setEnabled(true);
        mRbShield.setEnabled(true);
        mRbSave.setEnabled(true);
    } else if (checkedId == mRbCustom.getId()) {
        mCbClosePreview.setEnabled(false);
        mCbImageOrVideo.setEnabled(true);
        mRgNextPickType.setEnabled(true);
        mCbShowOriginal.setEnabled(false);
        mRbCrop.setEnabled(true);
        mRbMulti.setChecked(true);
        mRbNew.setEnabled(true);
        mRbShield.setEnabled(true);
        mRbSave.setEnabled(true);
    }
}
 
源代码30 项目: BaoKanAndroid   文件: MainActivity.java
/**
 * 监听tabbarItem切换事件
 */
private void setItemListener() {
    mRgTabbar.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            switch (checkedId) {
                case R.id.rb_news_item:
                    position = 0;
                    break;
                case R.id.rb_photo_item:
                    position = 1;
                    break;
                case R.id.rb_hot_item:
                    position = 2;
                    break;
                case R.id.rb_profile_item:
                    position = 3;
                    break;
                default:
                    position = 0;
                    break;
            }

            // 切换fragment
            Fragment currentFragment = mBaseFragments.get(position);
            switchFragment(mPreviousFragment, currentFragment);
        }
    });

    // 默认选中第一个item
    mRgTabbar.check(R.id.rb_news_item);
}
 
 类所在包
 同包方法