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


Java CheckedTextView.setCompoundDrawablePadding方法代码示例

本文整理汇总了Java中android.widget.CheckedTextView.setCompoundDrawablePadding方法的典型用法代码示例。如果您正苦于以下问题:Java CheckedTextView.setCompoundDrawablePadding方法的具体用法?Java CheckedTextView.setCompoundDrawablePadding怎么用?Java CheckedTextView.setCompoundDrawablePadding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.CheckedTextView的用法示例。


在下文中一共展示了CheckedTextView.setCompoundDrawablePadding方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: getView

import android.widget.CheckedTextView; //导入方法依赖的package包/类
public View getView(int position, View view, ViewGroup parent) {
    if (view == null) {
        LayoutInflater inflater = getLayoutInflater();
        view = inflater.inflate(android.R.layout.simple_list_item_multiple_choice, null, true);
    }
    CheckedTextView checkedTextView = (CheckedTextView) view;
    checkedTextView.setText(apps[position].name);
    checkedTextView.setCompoundDrawablesWithIntrinsicBounds(apps[position].icon, null, null, null);
    checkedTextView.setCompoundDrawablePadding((int) (8 * getResources().getDisplayMetrics().density));

    return view;
}
 
开发者ID:KDE,项目名称:kdeconnect-android,代码行数:13,代码来源:NotificationFilterActivity.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: getView

import android.widget.CheckedTextView; //导入方法依赖的package包/类
/**
    *    Get current visible item. Usually this is called only when the spinner is created.
    */
@Override
public View getView(int position, View convertView, ViewGroup parent){ 
	
	View row;

	LayoutInflater inflater = context.getLayoutInflater();
	row = inflater.inflate(R.layout.spinner_categ_item, parent, false);

	if (parent.getChildCount() > 0 || Fragment_NewIssueA.spPosition != -1) { 
		
		Category item = data.get(position);

		// Parse the data from each object and set it.
		if(item != null){
			
			ImageView cat_imv   = (ImageView) row.findViewById(R.id.categIcon);
			CheckedTextView cat_tv = (CheckedTextView) row.findViewById(R.id.categName);

			cat_tv.setCheckMarkDrawable(null);

			if(cat_imv != null && item._icon!=null){
				Bitmap bmicon = BitmapFactory.decodeByteArray(item._icon, 0, item._icon.length);

				if (item._level == 2)
					bmicon = Bitmap.createScaledBitmap(bmicon, (int) (45 * dens + 0.5f), (int) (50 * dens + 0.5f), true);
				else
					bmicon = Bitmap.createScaledBitmap(bmicon, (int) (50 * dens + 0.5f), (int) (55 * dens + 0.5f), true);

				cat_tv.setCompoundDrawablesWithIntrinsicBounds(new BitmapDrawable(bmicon), null, null, null);
			} else {
				cat_tv.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);

			}

			cat_tv.setCompoundDrawablePadding(20);

			if(cat_tv != null){
				cat_tv.setText(item._name);
				cat_tv.setTextSize(15);
			}
		} 
		
       } else { // Before appearance of the Spinner
       	((CheckedTextView)row.findViewById(R.id.categName)).setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
       }
	
	return row;
}
 
开发者ID:MKLab-ITI,项目名称:ImproveMyCity-Mobile,代码行数:52,代码来源:SpinnerAdapter_NewIssueCateg.java


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