當前位置: 首頁>>代碼示例>>Java>>正文


Java RadioButton.setLayoutParams方法代碼示例

本文整理匯總了Java中android.widget.RadioButton.setLayoutParams方法的典型用法代碼示例。如果您正苦於以下問題:Java RadioButton.setLayoutParams方法的具體用法?Java RadioButton.setLayoutParams怎麽用?Java RadioButton.setLayoutParams使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.widget.RadioButton的用法示例。


在下文中一共展示了RadioButton.setLayoutParams方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setImage

import android.widget.RadioButton; //導入方法依賴的package包/類
public void setImage(ArrayList<Integer> imageList) {
	for (int i = 0; i < imageList.size(); i++) {
		Integer imageID = ((Integer) imageList.get(i)).intValue();
		ImageView iv = new ImageView(mContext);
		iv.setLayoutParams(new LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
		iv.setScaleType(ImageView.ScaleType.FIT_XY);
		iv.setImageResource(imageID);
		iv.setOnClickListener(this);
		mViewList.add(iv);
	}
	mPager.setAdapter(new ImageAdapater());
	mPager.addOnPageChangeListener(new SimpleOnPageChangeListener() {
		@Override
		public void onPageSelected(int position) {
			setButton(position);
		}
	});

	mCount = imageList.size();
	for (int i = 0; i < mCount; i++) {
		RadioButton radio = new RadioButton(mContext);
		radio.setLayoutParams(new RadioGroup.LayoutParams(dip_15, dip_15));
		radio.setGravity(Gravity.CENTER);
		radio.setButtonDrawable(R.drawable.indicator_selector);
		mGroup.addView(radio);
	}
	mPager.setCurrentItem(0);
	setButton(0);
}
 
開發者ID:Luodian,項目名稱:Shared-Route,代碼行數:31,代碼來源:BannerPager.java

示例2: addIndex

import android.widget.RadioButton; //導入方法依賴的package包/類
/**
 * 添加指示器
 */
private void addIndex(){
    RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(10,0,10,0);
    RadioButton radioButton = new RadioButton(getContext());
    radioButton.setLayoutParams(layoutParams);
    radioButton.setButtonDrawable(indicatorResId);
    radioButton.setEnabled(false);
    buttons.add(radioButton);
}
 
開發者ID:Militch,項目名稱:banner-holder,代碼行數:13,代碼來源:BannerHolderView.java

示例3: getRadios

import android.widget.RadioButton; //導入方法依賴的package包/類
private static View getRadios(Activity activity, LayoutInflater inflater, final SignUpEventOptions options) {
    View view = inflater.inflate(R.layout.event_sign_up_radios, null);
    ((TextView) view.findViewById(R.id.tv_label)).setText(options.getLabel() + (options.isRequired() ? "" : "(選填)") + ":");
    RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.rg_options);
    RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    params.setMarginEnd(100);
    if (!TextUtils.isEmpty(options.getOption())) {
        String[] list = options.getOption().split(";");
        String[] status = null;
        if (!TextUtils.isEmpty(options.getOptionStatus()))
            status = options.getOptionStatus().split(";");
        for (int i = 0; i < list.length; i++) {
            RadioButton button = new RadioButton(activity);
            button.setLayoutParams(params);
            button.setText(list[i]);
            if (!TextUtils.isEmpty(options.getDefaultValue())) {
                button.setChecked(list[0].equals(options.getDefaultValue()));
                options.setValue(options.getDefaultValue());
            } else {
                button.setChecked(i == 0);
                options.setValue(list[0]);
            }
            boolean enable;
            if (status == null)
                enable = true;
            else if (status.length <= i)
                enable = true;
            else
                enable = "0".equals(status[0]);
            button.setId(i);
            button.setEnabled(enable);
            radioGroup.addView(button);
        }
    }
    radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            String s[] = options.getOption().split(";");
            if (s != null)
                options.setValue(s[checkedId]);
        }
    });
    return view;
}
 
開發者ID:hsj-xiaokang,項目名稱:OSchina_resources_android,代碼行數:47,代碼來源:ViewFactory.java

示例4: initView

import android.widget.RadioButton; //導入方法依賴的package包/類
private void initView() {
    final RadioGroup group = (RadioGroup) getView().findViewById(
            R.id.ringtoneGroup);

    RingtoneManager manager = new RingtoneManager(getActivity());
    manager.setType(RingtoneManager.TYPE_RINGTONE);
    int pdng = (int) (5 * getResources().getDisplayMetrics().density + .5f);
    final String[] columns = {MediaStore.Images.Media.DATA,
            MediaStore.Audio.Media._ID};
    final String orderBy = MediaStore.Images.Media._ID;
    Cursor imagecursor = getActivity().getContentResolver().query(
            MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, columns, null,
            null, orderBy);
    int dataColumnIndex = imagecursor
            .getColumnIndex(MediaStore.Audio.Media.DATA);
    for (int i = 0; i < imagecursor.getCount(); i++) {
        imagecursor.moveToPosition(i);
        final String uri = imagecursor.getString(dataColumnIndex);
        final String title = uri.substring(uri.lastIndexOf("/") + 1);
        RadioButton rb = new RadioButton(getActivity());
        rb.setLayoutParams(new RadioGroup.LayoutParams(
                RadioGroup.LayoutParams.MATCH_PARENT,
                RadioGroup.LayoutParams.WRAP_CONTENT));
        rb.setText(title);
        rb.setTypeface(((OneSheeldApplication) getActivity()
                .getApplication()).appFont);
        rb.setGravity(Gravity.CENTER);
        rb.setPadding(pdng, pdng, pdng, pdng);
        rb.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
        rb.setTextColor(getResources().getColor(R.color.textColorOnDark));
        rb.setBackgroundResource(R.drawable.devices_list_item_selector);
        rb.setTag(uri);
        rb.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                ((OneSheeldApplication) getActivity().getApplication())
                        .setBuzzerSound(uri);
            }
        });
        group.addView(rb);
    }
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:44,代碼來源:BuzzerShieldSettings.java


注:本文中的android.widget.RadioButton.setLayoutParams方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。