本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
}