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


Java CheckedTextView.setLayoutParams方法代碼示例

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


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

示例1: setupTopModulePager

import android.widget.CheckedTextView; //導入方法依賴的package包/類
protected void setupTopModulePager(LayoutInflater inflater, ViewGroup container, View view, String[] buttonTitles) {
    int dp4 = DisplayUtils.dpToPx(view.getContext(), 4);
    int dp80 = DisplayUtils.dpToPx(view.getContext(), 80);

    for (int i = 0; i < buttonTitles.length; i++) {
        CheckedTextView rb = (CheckedTextView) inflater.inflate(R.layout.stats_top_module_pager_button, container, false);
        RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(RadioGroup.LayoutParams.MATCH_PARENT,
                RadioGroup.LayoutParams.WRAP_CONTENT);
        params.weight = 1;
        rb.setTypeface((TypefaceCache.getTypeface(view.getContext())));
        if (i == 0) {
            params.setMargins(0, 0, dp4, 0);
        } else {
            params.setMargins(dp4, 0, 0, 0);
        }
        rb.setMinimumWidth(dp80);
        rb.setGravity(Gravity.CENTER);
        rb.setLayoutParams(params);
        rb.setText(buttonTitles[i]);
        rb.setChecked(i == mTopPagerSelectedButtonIndex);
        rb.setOnClickListener(TopModulePagerOnClickListener);
        mTopPagerContainer.addView(rb);
    }
    mTopPagerContainer.setVisibility(View.VISIBLE);
}
 
開發者ID:ldsddn,項目名稱:wordpress_app_android,代碼行數:26,代碼來源:StatsAbstractListFragment.java

示例2: initUi

import android.widget.CheckedTextView; //導入方法依賴的package包/類
private void initUi() {
    followCheckedText = new CheckedTextView(getActivity());
    try {
        followCheckedText.setBackgroundColor(getActivity().getResources().getColor(android.R.color.white));
    } catch (Throwable t) {
        Log.w(TAG, t);
    }
    followCheckedText.setChecked(true);
    int dp_10 = com.mob.tools.utils.R.dipToPx(getActivity(), 10);
    followCheckedText.setCompoundDrawablePadding(dp_10);
    followCheckedText.setCompoundDrawablesWithIntrinsicBounds(R.drawable.bg_checkbox, 0, 0, 0);
    followCheckedText.setGravity(Gravity.CENTER_VERTICAL);
    followCheckedText.setPadding(dp_10, dp_10, dp_10, dp_10);
    followCheckedText.setText(R.string.follow_us);
    followCheckedText.setTextColor(0xff909090);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    followCheckedText.setLayoutParams(lp);
    LinearLayout llBody = (LinearLayout) getBodyView().getChildAt(0);
    llBody.addView(followCheckedText);
    followCheckedText.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            CheckedTextView ctv = (CheckedTextView) v;
            ctv.setChecked(!ctv.isChecked());
        }
    });

    followCheckedText.measure(0, 0);
    int height = followCheckedText.getMeasuredHeight();
    TranslateAnimation animShow = new TranslateAnimation(
            Animation.RELATIVE_TO_SELF, 0,
            Animation.RELATIVE_TO_SELF, 0,
            Animation.ABSOLUTE, height,
            Animation.ABSOLUTE, 0);
    animShow.setDuration(1000);
    getWebBody().startAnimation(animShow);
    followCheckedText.startAnimation(animShow);
}
 
開發者ID:ourbeehive,項目名稱:AndPlug,代碼行數:40,代碼來源:ShareSDKAuthorizeAdapter.java

示例3: initUi

import android.widget.CheckedTextView; //導入方法依賴的package包/類
private void initUi(String platName) {
	ctvFollow = new CheckedTextView(getActivity());
	try {
		ctvFollow.setBackgroundResource(R.drawable.auth_follow_bg);
	} catch (Throwable t) {
		t.printStackTrace();
	}
	ctvFollow.setChecked(true);
	int dp_10 = cn.sharesdk.framework.utils.R.dipToPx(getActivity(), 10);
	ctvFollow.setCompoundDrawablePadding(dp_10);
	ctvFollow.setCompoundDrawablesWithIntrinsicBounds(R.drawable.auth_cb, 0, 0, 0);
	ctvFollow.setGravity(Gravity.CENTER_VERTICAL);
	ctvFollow.setPadding(dp_10, dp_10, dp_10, dp_10);
	ctvFollow.setText(R.string.sm_item_fl_weibo);
	if (platName.equals("TencentWeibo")) {
		ctvFollow.setText(R.string.sm_item_fl_tc);
	}
	ctvFollow.setTextColor(0xff909090);
	LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	ctvFollow.setLayoutParams(lp);
	LinearLayout llBody = (LinearLayout) getBodyView().getChildAt(0);
	llBody.addView(ctvFollow);
	ctvFollow.setOnClickListener(this);

	ctvFollow.measure(0, 0);
	int height = ctvFollow.getMeasuredHeight();
	TranslateAnimation animShow = new TranslateAnimation(
			Animation.RELATIVE_TO_SELF, 0,
			Animation.RELATIVE_TO_SELF, 0,
			Animation.ABSOLUTE, height,
			Animation.ABSOLUTE, 0);
	animShow.setDuration(1000);
	getWebBody().startAnimation(animShow);
	ctvFollow.startAnimation(animShow);
}
 
開發者ID:snowdream,項目名稱:android-sharesdk,代碼行數:37,代碼來源:MyAdapter.java

示例4: addTags

import android.widget.CheckedTextView; //導入方法依賴的package包/類
private void addTags(View listviewHeader) {
    listChecks = new ArrayList<>();
    for(int i = 0; i < AppInfo.genresSize; ++i) {

        FlexboxLayout.LayoutParams layoutParams = new FlexboxLayout.LayoutParams(FlexboxLayout.LayoutParams.WRAP_CONTENT, FlexboxLayout
                .LayoutParams.WRAP_CONTENT);

        layoutParams.rightMargin = 20;
        layoutParams.bottomMargin = 20;
        CheckedTextView sample = new CheckedTextView(getContext());
        sample.setText(AppInfo.genres[i]);
        sample.setBackground(getResources().getDrawable(R.drawable.chk_indicator));
        sample.setPadding(20,20,20,20);
        sample.setLayoutParams(layoutParams);
        sample.setChecked(false);
        final int id = i;
        sample.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if(id == 0) {
                    if(listChecks.get(id).isChecked() == false) {
                        mask = 0;
                        listChecks.get(id).setChecked(true);
                        for(int i = 1; i < AppInfo.genresSize; ++i) {
                            if(listChecks.get(i).isChecked() == true) {
                                listChecks.get(i).setChecked(false);
                            }
                        }
                    }
                }
                else {
                    if (listChecks.get(id).isChecked() == true) {
                        mask = (mask ^ (1 << (id - 1)));
                        listChecks.get(id).setChecked(false);
                    } else {
                        mask = (mask | (1 << (id - 1)));
                        if (listChecks.get(0).isChecked() == true) {
                            listChecks.get(0).setChecked(false);
                        }
                        listChecks.get(id).setChecked(true);
                    }
                }

                searchQuery(searchView.getQuery().toString());

            }
        });
        listChecks.add(sample);
        FlexboxLayout headerLayout = (FlexboxLayout) listviewHeader.findViewById(R.id.flexLayout);
        headerLayout.addView(sample);
    }
}
 
開發者ID:CoderINusE,項目名稱:Groovy,代碼行數:53,代碼來源:SearchTab.java


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