本文整理了Java中android.widget.Button.setTextColor()
方法的一些代码示例,展示了Button.setTextColor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.setTextColor()
方法的具体详情如下:
包路径:android.widget.Button
类名称:Button
方法名:setTextColor
暂无
代码示例来源:origin: aa112901/remusic
@Override
public void setTextColor(int color) {
super.setTextColor(color);
if (mTextHelper != null) {
mTextHelper.setTextColor();
}
}
代码示例来源:origin: aa112901/remusic
@Override
public void setTextColor(ColorStateList colors) {
super.setTextColor(colors);
if (mTextHelper != null) {
mTextHelper.setTextColor();
}
}
代码示例来源:origin: ZieIony/Carbon
@Override
public void setTextColor(ColorStateList colors) {
super.setTextColor(animateColorChanges && !(colors instanceof AnimatedColorStateList) ? AnimatedColorStateList.fromList(colors, textColorAnimatorListener) : colors);
}
代码示例来源:origin: andkulikov/Transitions-Everywhere
@Override
public void onClick(View v) {
TransitionManager.beginDelayedTransition(transitionsContainer, new Recolor());
mColorsInverted = !mColorsInverted;
button.setTextColor(getResources().getColor(!mColorsInverted ? R.color.second_accent : R.color.accent));
button.setBackgroundDrawable(
new ColorDrawable(getResources().getColor(!mColorsInverted ? R.color.accent : R.color.second_accent)));
}
代码示例来源:origin: Bigkoo/Android-PickerView
btnSubmit.setTextColor(mPickerOptions.textColorConfirm);
btnCancel.setTextColor(mPickerOptions.textColorCancel);
tvTitle.setTextColor(mPickerOptions.textColorTitle);
rv_top_bar.setBackgroundColor(mPickerOptions.bgColorTitle);
代码示例来源:origin: jeasonlzy/ImagePicker
@SuppressLint("StringFormatMatches")
@Override
public void onImageSelected(int position, ImageItem item, boolean isAdd) {
if (imagePicker.getSelectImageCount() > 0) {
mBtnOk.setText(getString(R.string.ip_select_complete, imagePicker.getSelectImageCount(), imagePicker.getSelectLimit()));
mBtnOk.setEnabled(true);
mBtnPre.setEnabled(true);
mBtnPre.setText(getResources().getString(R.string.ip_preview_count, imagePicker.getSelectImageCount()));
mBtnPre.setTextColor(ContextCompat.getColor(this, R.color.ip_text_primary_inverted));
mBtnOk.setTextColor(ContextCompat.getColor(this, R.color.ip_text_primary_inverted));
} else {
mBtnOk.setText(getString(R.string.ip_complete));
mBtnOk.setEnabled(false);
mBtnPre.setEnabled(false);
mBtnPre.setText(getResources().getString(R.string.ip_preview));
mBtnPre.setTextColor(ContextCompat.getColor(this, R.color.ip_text_secondary_inverted));
mBtnOk.setTextColor(ContextCompat.getColor(this, R.color.ip_text_secondary_inverted));
}
// mImageGridAdapter.notifyDataSetChanged();
// mRecyclerAdapter.notifyItemChanged(position); // 17/4/21 fix the position while click img to preview
// mRecyclerAdapter.notifyItemChanged(position + (imagePicker.isShowCamera() ? 1 : 0));// 17/4/24 fix the position while click right bottom preview button
for (int i = imagePicker.isShowCamera() ? 1 : 0; i < mRecyclerAdapter.getItemCount(); i++) {
if (mRecyclerAdapter.getItem(i).path != null && mRecyclerAdapter.getItem(i).path.equals(item.path)) {
mRecyclerAdapter.notifyItemChanged(i);
return;
}
}
}
代码示例来源:origin: TangoAgency/material-intro-screen
private void setViewsColor(int position, float offset) {
int backgroundColor = getBackgroundColor(position, offset);
viewPager.setBackgroundColor(backgroundColor);
messageButton.setTextColor(backgroundColor);
int buttonsColor = getButtonsColor(position, offset);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(buttonsColor);
}
pageIndicator.setPageIndicatorColor(buttonsColor);
tintButtons(ColorStateList.valueOf(buttonsColor));
}
代码示例来源:origin: jaydenxiao2016/AndroidFire
mContent.setTextSize(builder.getContentTextSize());
mLeftBtn.setText(builder.getLeftButtonText());
mLeftBtn.setTextColor(builder.getLeftButtonTextColor());
mLeftBtn.setTextSize(builder.getButtonTextSize());
mRightBtn.setText(builder.getRightButtonText());
mRightBtn.setTextColor(builder.getRightButtonTextColor());
mRightBtn.setTextSize(builder.getButtonTextSize());
mSingleBtn.setText(builder.getSingleButtonText());
mSingleBtn.setTextColor(builder.getSingleButtonTextColor());
mSingleBtn.setTextSize(builder.getButtonTextSize());
代码示例来源:origin: jaydenxiao2016/AndroidFire
private void initView() {
rlTitleBar = (RelativeLayout) findViewById(R.id.rlTitleBar);
tvTitle = (TextView) findViewById(R.id.tvTitle);
btnConfirm = (Button) findViewById(R.id.btnConfirm);
btnConfirm.setOnClickListener(this);
ivBack = (ImageView) findViewById(R.id.ivBack);
ivBack.setOnClickListener(this);
if (config != null) {
if (config.backResId != -1) {
ivBack.setImageResource(config.backResId);
}
if (config.statusBarColor != -1) {
StatusBarCompat.compat(this, config.statusBarColor);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
&& Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
//透明状态栏
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
rlTitleBar.setBackgroundColor(config.titleBgColor);
tvTitle.setTextColor(config.titleColor);
tvTitle.setText(config.title);
btnConfirm.setBackgroundColor(config.btnBgColor);
btnConfirm.setTextColor(config.btnTextColor);
}
}
代码示例来源:origin: jaydenxiao2016/AndroidFire
private Button getButton(String text, int position) {
// 动态生成选择按钮
final Button button = new Button(mContext);
button.setText(text);
button.setTag(position);
button.setTextColor(mBuilder.getItemTextColor());
button.setTextSize(mBuilder.getItemTextSize());
button.setLayoutParams(new LinearLayout.LayoutParams(AbsListView.LayoutParams
.MATCH_PARENT, mBuilder.getItemHeight()));
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
if (mBuilder.getOnItemListener() != null) {
selectPosition = Integer.parseInt(button.getTag().toString());
mBuilder.getOnItemListener().onItemClick(button, selectPosition);
}
}
});
return button;
}
代码示例来源:origin: wdullaer/MaterialDateTimePicker
if (mOkColor != -1) okButton.setTextColor(mOkColor);
else okButton.setTextColor(mAccentColor);
if (mCancelColor != -1) cancelButton.setTextColor(mCancelColor);
else cancelButton.setTextColor(mAccentColor);
代码示例来源:origin: Bigkoo/Android-PickerView
btnSubmit.setTextColor(mPickerOptions.textColorConfirm);
btnCancel.setTextColor(mPickerOptions.textColorCancel);
tvTitle.setTextColor(mPickerOptions.textColorTitle);
rv_top_bar.setBackgroundColor(mPickerOptions.bgColorTitle);
代码示例来源:origin: WVector/AppUpdate
/**
* 设置
*
* @param color 主色
* @param topResId 图片
*/
private void setDialogTheme(int color, int topResId) {
mTopIv.setImageResource(topResId);
mUpdateOkButton.setBackgroundDrawable(DrawableUtil.getDrawable(AppUpdateUtils.dip2px(4, getActivity()), color));
mNumberProgressBar.setProgressTextColor(color);
mNumberProgressBar.setReachedBarColor(color);
//随背景颜色变化
mUpdateOkButton.setTextColor(ColorUtil.isTextColorDark(color) ? Color.BLACK : Color.WHITE);
}
代码示例来源:origin: Kaopiz/android-segmented-control
{android.R.attr.state_checked}},
new int[]{mTintColor, mCheckedTextColor});
((Button) view).setTextColor(colorStateList);
代码示例来源:origin: jaydenxiao2016/AndroidFire
bottomBtn.setTextColor(mBuilder.getItemTextColor());
bottomBtn.setTextSize(mBuilder.getItemTextSize());
LinearLayout.LayoutParams btnlp = new LinearLayout.LayoutParams(AbsListView.LayoutParams
代码示例来源:origin: jaydenxiao2016/AndroidFire
private Button getButton(String text, int position) {
// 动态生成选择按钮
final Button button = new Button(mContext);
button.setText(text);
button.setTag(position);
button.setTextColor(mBuilder.getItemTextColor());
button.setTextSize(mBuilder.getItemTextSize());
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams
.MATCH_PARENT, mBuilder.getItemHeight());
button.setLayoutParams(lp);
button.setGravity(Gravity.LEFT|Gravity.CENTER_VERTICAL);
button.setPadding(UiUtils.dp2px(mContext,10),0,UiUtils.dp2px(mContext,10),0);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
if (mBuilder.getOnItemListener() != null) {
selectPosition = Integer.parseInt(button.getTag().toString());
mBuilder.getOnItemListener().onItemClick(button, selectPosition);
}
}
});
return button;
}
代码示例来源:origin: JohnPersano/SuperToasts
this.mStyle.buttonText.toUpperCase() : "");
button.setTypeface(button.getTypeface(), this.mStyle.buttonTypefaceStyle);
button.setTextColor(this.mStyle.buttonTextColor);
button.setTextSize(this.mStyle.buttonTextSize);
代码示例来源:origin: termux/termux-app
button.setTextColor(TEXT_COLOR);
button.setPadding(0, 0, 0, 0);
代码示例来源:origin: termux/termux-app
void popup(View view, String text) {
int width = view.getMeasuredWidth();
int height = view.getMeasuredHeight();
Button button = new Button(getContext(), null, android.R.attr.buttonBarButtonStyle);
button.setText(text);
button.setTextColor(TEXT_COLOR);
button.setPadding(0, 0, 0, 0);
button.setMinHeight(0);
button.setMinWidth(0);
button.setMinimumWidth(0);
button.setMinimumHeight(0);
button.setWidth(width);
button.setHeight(height);
button.setBackgroundColor(BUTTON_PRESSED_COLOR);
popupWindow = new PopupWindow(this);
popupWindow.setWidth(LayoutParams.WRAP_CONTENT);
popupWindow.setHeight(LayoutParams.WRAP_CONTENT);
popupWindow.setContentView(button);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(false);
popupWindow.showAsDropDown(view, 0, -2 * height);
}
代码示例来源:origin: TangoAgency/material-intro-screen
@Override
public void pageScrolled(int position, float offset) {
if (position < adapter.getCount() - 1) {
setViewsColor(position, offset);
} else if (adapter.getCount() == 1) {
viewPager.setBackgroundColor(adapter.getItem(position).backgroundColor());
messageButton.setTextColor(adapter.getItem(position).backgroundColor());
tintButtons(ColorStateList.valueOf(adapter.getItem(position).buttonsColor()));
}
}
内容来源于网络,如有侵权,请联系作者删除!