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


Java CheckedTextView.setTextColor方法代碼示例

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


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

示例1: bindView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public void bindView(View view, Context context, Cursor cursor) {
    CheckedTextView textView = (CheckedTextView) view;
    textView.setText(cursor.getString(cursor.getColumnIndexOrThrow(Table.Event.NAME)));
    String eventId = cursor.getString(cursor.getColumnIndexOrThrow(Table.Event.ID));
    view.setTag(eventId);
    if (textView.getPaddingLeft() > 0) { // on Dropdown
        long endTime = cursor.getLong(cursor.getColumnIndexOrThrow(Table.Event.END_TIME));
        if (TextUtils.equals(mCurrentEventId, eventId)) {
            textView.setTextColor(mTextColorCurrent);
        } else if (endTime * 1000 < System.currentTimeMillis()) { // Past
            textView.setTextColor(mTextColorPast);
        } else {
            textView.setTextColor(mTextColorDefault);
        }
    } else { // on Toolbar
        textView.setTextColor(mTextColorInverse);
    }
}
 
開發者ID:googlesamples,項目名稱:attendee-checkin,代碼行數:20,代碼來源:EventSelectionFragment.java

示例2: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
/**
 * Remove offline icon for selected camera that is showing as title
 */
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = super.getView(position, convertView, parent);
    ImageView offlineIcon = (ImageView) view.findViewById(R.id.spinner_offline_icon);
    offlineIcon.setVisibility(View.GONE);

    //Title text should be white
    CheckedTextView titleTextView = (CheckedTextView) view.findViewById(R.id.spinner_camera_name_text);
    titleTextView.setTextColor(Color.WHITE);

    //Make spinner text fit landscape too
    RelativeLayout layout = (RelativeLayout) view.findViewById(R.id.list_spinner_layout);
    layout.setPadding(10, 0, 10, 0);

    return view;
}
 
開發者ID:evercam,項目名稱:evercam-android,代碼行數:20,代碼來源:CameraListAdapter.java

示例3: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    final View itemView = super.getView(position, convertView, parent);
    if (itemView == null) {
        return null;
    }
    final CheckedTextView checkedTextView = (CheckedTextView)itemView;

    if (hasCheckbox(position)) {
        checkedTextView.setEnabled(isEnabled(position));
    } else {
        checkedTextView.setCheckMarkDrawable(null);
        checkedTextView.setTextColor(getResources().getColor(R.color.accent));
    }
    return checkedTextView;
}
 
開發者ID:doc-rj,項目名稱:smartcard-reader,代碼行數:17,代碼來源:AppEditActivity.java

示例4: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = mInflater.inflate(R.layout.folder_item, parent, false);
    }

    String folder = getItem(position);

    CheckedTextView tv = (CheckedTextView) convertView.findViewById(R.id.cb_folder);
    tv.setText(folder);
    if (mHiddenFolders.contains(folder.hashCode())) {
        // this folder was set to be hidden
        tv.setChecked(false);
        tv.setTextColor(Color.LTGRAY);
    } else {
        // set default status
        tv.setChecked(true);
        tv.setTextColor(Color.BLACK);
    }

    return convertView;
}
 
開發者ID:LudySu,項目名稱:LrcJaeger,代碼行數:23,代碼來源:HideFoldersActivity.java

示例5: addArmorButton

import android.widget.CheckedTextView; //導入方法依賴的package包/類
protected TextView addArmorButton(Position pos) {
	CheckedTextView rsText = new CheckedTextView(getContext());

	rsText.setCheckMarkDrawable(0);
	rsText.setBackgroundResource(R.drawable.icon_armor_btn);
	rsText.setOnClickListener(onArmorClickListener);
	rsText.setOnLongClickListener(onArmorLongClickListener);
	rsText.setGravity(Gravity.CENTER);
	rsText.setTextColor(getResources().getColor(android.R.color.primary_text_light));

	addView(rsText, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, null, pos));

	armorButtons.put(pos, rsText);

	rsText.measure(rsWidthMeasureSpec, rsHeightMeasureSpec);

	rsText.setTextSize(TypedValue.COMPLEX_UNIT_PX, rsText.getMeasuredHeight() / 1.7f);

	return rsText;
}
 
開發者ID:gandulf,項目名稱:DsaTab,代碼行數:21,代碼來源:BodyLayout.java

示例6: enableBlinkLED

import android.widget.CheckedTextView; //導入方法依賴的package包/類
/**
 * Enables or disables the ability to change the blink LED function.
 * It also changes the color of the view
 */
private static void enableBlinkLED(boolean boo, Activity ac) {
	final CheckedTextView soundPlayView = (CheckedTextView) ac.findViewById(R.id.notifications_led);
	MaterialRippleLayout rippleSoundPlay = (MaterialRippleLayout) ac.findViewById(R.id.notifications_led_ripple);

	int color = getEnabledTextColor(ac);

	if(!boo)
		color = getDisabledTextColor(ac);

	soundPlayView.setTextColor(color);
	rippleSoundPlay.setEnabled(boo);
}
 
開發者ID:SebastianRask,項目名稱:Pocket-Plays-for-Twitch,代碼行數:17,代碼來源:SettingsNotificationsActivity.java

示例7: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    Sex sex = getItem(position);
    View view = super.getView(position, convertView, parent);
    CheckedTextView textView = (CheckedTextView) view.findViewById(mTextId);
    MDTintHelper.setTint(textView, getContext().getResources().getColor(sex.color));
    textView.setTextColor(getContext().getResources().getColor(sex.color));
    return view;
}
 
開發者ID:iQuick,項目名稱:NewsMe,代碼行數:10,代碼來源:SexUtil.java

示例8: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
        public View getView(int position, View convertView, ViewGroup parent) {
            Theme theme = getItem(position);
            View view = super.getView(position, convertView, parent);
            CheckedTextView textView = (CheckedTextView) view.findViewById(mTextId);
            MDTintHelper.setTint(textView, getContext().getResources().getColor(theme.color));
            textView.setTextColor(getContext().getResources().getColor(theme.color));
//            textView.setChecked(convertView.getiss);
//            textView.setChecked(true);
            return view;
        }
 
開發者ID:iQuick,項目名稱:NewsMe,代碼行數:12,代碼來源:ThemeUtils.java

示例9: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    View view = convertView;
    Typeface font = getFontByNumber(context, position);
    if (view == null) {
        final LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(android.R.layout.select_dialog_singlechoice, parent, false);
    }
    CheckedTextView item = (CheckedTextView) view.findViewById(android.R.id.text1);
    item.setText(items[position]);
    item.setTypeface(font);
    item.setTextColor(Color.WHITE);
    return view;
}
 
開發者ID:rosenpin,項目名稱:AlwaysOnDisplayAmoled,代碼行數:15,代碼來源:FontAdapter.java

示例10: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
public View getView(final int position, View convertView, ViewGroup parent) {
    View row = convertView;

    if (row == null) {
        row = mInflater.inflate(android.R.layout.simple_list_item_single_choice, parent, false);
    }
    CheckedTextView tv = (CheckedTextView) row.findViewById(android.R.id.text1);
    tv.setText(getItem(position).toString());
    tv.setChecked(mEntryIndex == position);
    tv.setTextColor(Color.parseColor(colors[position]));
    return row;
}
 
開發者ID:goodev,項目名稱:droidddle,代碼行數:13,代碼來源:ThemeListPreference.java

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

示例12: getView

import android.widget.CheckedTextView; //導入方法依賴的package包/類
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	LayoutInflater inflater = ((Activity) getContext()).getLayoutInflater();
	View view = inflater.inflate(R.layout.dialog_image_list_preference,
			parent, false);

	ImageView imageView = (ImageView) view
			.findViewById(R.id.dialog_image_list_preference_image);
	String name = mImagePaths[position];
	name = name.substring(name.lastIndexOf('/') + 1, name.lastIndexOf('.'));

	int resId = getContext().getResources().getIdentifier(name, "drawable",
			getContext().getPackageName());
	imageView.setImageResource(resId);

	CheckedTextView checkedTextView = (CheckedTextView) view
			.findViewById(R.id.dialog_image_list_preference_check);

	if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
		checkedTextView.setTextColor(Color.BLACK);
		imageView.setBackgroundColor(Color.DKGRAY);
	}

	checkedTextView.setText(getItem(position));

	if (position == mIndex) {
		checkedTextView.setChecked(true);
	}

	return view;
}
 
開發者ID:zeitgeist87,項目名稱:SpartanTimeLapseRecorder,代碼行數:32,代碼來源:IconArrayAdapter.java

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

示例14: init

import android.widget.CheckedTextView; //導入方法依賴的package包/類
/**
 * 初始化控件
 */
private void init(final Context context) {
	this.setOrientation(LinearLayout.HORIZONTAL);
	this.setBackgroundResource(R.drawable.index_bottom_bar);

	LayoutInflater inflater = LayoutInflater.from(context);

	LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
	params.weight = 1.0f;
	params.gravity = Gravity.CENTER;
	mCheckedList.clear();
	int size = mLabels.length;
	for (int i = 0; i < size; i++) {

		final int index = i;

		// 每個tab對應的layout
		final View view = inflater.inflate(R.layout.tab_item, null);
		final CheckedTextView itemName = (CheckedTextView) view
				.findViewById(R.id.item_name);
		ImageView imageView = (ImageView) view.findViewById(R.id.iv_bg);
		if(i == 2) {
			itemName.setVisibility(GONE);
			imageView.setVisibility(VISIBLE);
			imageView.setImageResource(mIconTa.getResourceId(i, 0));
			this.addView(view,params);
			// 將各個tab的View添加到list
			mViewList.add(view);

		}else {
			itemName.setCompoundDrawablesWithIntrinsicBounds(null, context
					.getResources().getDrawable(mIconTa.getResourceId(i, 0)), null, null);
			itemName.setText(mLabels[i]);
			itemName.setTextColor(mTextColorStateList);

			// 指示點ImageView,如有版本更新需要顯示
			final TextView indicateImg = (TextView) view
					.findViewById(R.id.tv_message_indicator);
			this.addView(view, params);

			// 將CheckedTextView添加到list中,便於操作
			mCheckedList.add(itemName);
			// 將指示圖片加到list,便於控製顯示隱藏
			mMessageIndicate.add(indicateImg);
			// 將各個tab的View添加到list
			mViewList.add(view);
		}

		// CheckedTextView設置索引作為tag,以便後續更改顏色、圖片等
		itemName.setTag(index);
		view.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {

				// 設置底部圖片和文字的顯示
				setTabsDisplay(index);

				if (null != mTabListener) {
					// tab項被選中的回調事件
					mTabListener.onTabSelected(index);
				}
			}
		});

		// 初始化 底部菜單選中狀態,默認第一個選中
		if (i == 0&&i!=2) {
			itemName.setChecked(true);
		} else if(i!=2){
			itemName.setChecked(false);
		}
	}
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:77,代碼來源:MyTabWidget.java


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