本文整理匯總了Java中android.support.v7.widget.AppCompatTextView.setTextColor方法的典型用法代碼示例。如果您正苦於以下問題:Java AppCompatTextView.setTextColor方法的具體用法?Java AppCompatTextView.setTextColor怎麽用?Java AppCompatTextView.setTextColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.widget.AppCompatTextView
的用法示例。
在下文中一共展示了AppCompatTextView.setTextColor方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createDialog
import android.support.v7.widget.AppCompatTextView; //導入方法依賴的package包/類
private static AlertDialog createDialog(final Context context) {
AppCompatTextView messageTextView = new AppCompatTextView(context);
messageTextView.setTextSize(16f);
messageTextView.setText(context.getString(R.string.download_manager_disabled));
messageTextView.setPadding(50, 50, 50, 0);
messageTextView.setTextColor(ContextCompat.getColor(context, R.color.black));
return new AlertDialog.Builder(context)
.setView(messageTextView)
.setPositiveButton("ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
enableDownloadManager(context);
}
})
.setCancelable(false)
.create();
}
示例2: onBindView
import android.support.v7.widget.AppCompatTextView; //導入方法依賴的package包/類
@Override
public void onBindView(@Nullable Bundle savedInstanceState, View rootView) {
final int size = ITEMS.size();
for (int i = 0; i < size; i++) {
LayoutInflater.from(getContext()).inflate(R.layout.bottom_item_icon_text_layout, mBottomBar);
final RelativeLayout item = (RelativeLayout) mBottomBar.getChildAt(i);
//設置每個item的點擊事件
item.setTag(i);
item.setOnClickListener(this);
final IconTextView itemIcon = (IconTextView) item.getChildAt(0);
final AppCompatTextView itemTitle = (AppCompatTextView) item.getChildAt(1);
final BottomTabBean bean = TAB_BEANS.get(i);
//初始化數據
itemIcon.setText(bean.getICON());
itemTitle.setText(bean.getTITLE());
if (i == mIndexDelegate) {
itemIcon.setTextColor(mClickedColor);
itemTitle.setTextColor(mClickedColor);
}
}
final ISupportFragment[] delegateArray = ITEM_DELEGATES.toArray(new ISupportFragment[size]);
getSupportDelegate().loadMultipleRootFragment(R.id.bottom_bar_delegate_container, mIndexDelegate, delegateArray);
}
示例3: resetColor
import android.support.v7.widget.AppCompatTextView; //導入方法依賴的package包/類
private void resetColor() {
final int count = mBottomBar.getChildCount();
for (int i = 0; i < count; i++) {
final RelativeLayout item = (RelativeLayout) mBottomBar.getChildAt(i);
final IconTextView itemIcon = (IconTextView) item.getChildAt(0);
itemIcon.setTextColor(Color.GRAY);
final AppCompatTextView itemTitle = (AppCompatTextView) item.getChildAt(1);
itemTitle.setTextColor(Color.GRAY);
}
}
示例4: onClick
import android.support.v7.widget.AppCompatTextView; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
final int tag = (int) v.getTag();
resetColor();
final RelativeLayout item = (RelativeLayout) v;
final IconTextView itemIcon = (IconTextView) item.getChildAt(0);
itemIcon.setTextColor(mClickedColor);
final AppCompatTextView itemTitle = (AppCompatTextView) item.getChildAt(1);
itemTitle.setTextColor(mClickedColor);
getSupportDelegate().showHideFragment(ITEM_DELEGATES.get(tag), ITEM_DELEGATES.get(mCurrentDelegate));
//注意先後順序
mCurrentDelegate = tag;
}
示例5: onCreateView
import android.support.v7.widget.AppCompatTextView; //導入方法依賴的package包/類
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.permission_rationale, container, false);
AppCompatTextView rationaleView = (AppCompatTextView) rootView.findViewById(R.id.permission_text);
rationaleView.setText(getArguments().getString(TEXT_KEY));
rationaleView.setTextSize(TypedValue.COMPLEX_UNIT_PX, getArguments().getFloat(TEXT_SIZE));
rationaleView.setTextColor(getArguments().getInt(TEXT_COLOR));
rationaleView.setTypeface(Typeface.createFromAsset(getResources().getAssets(), "fonts/" + getArguments().getString(TEXT_FONT)));
return rootView;
}
示例6: convert
import android.support.v7.widget.AppCompatTextView; //導入方法依賴的package包/類
@Override
protected void convert(final MultipleViewHolder holder, final MultipleItemEntity entity) {
super.convert(holder, entity);
switch (holder.getItemViewType()) {
case ItemType.VERTICAL_MENU_LIST:
final String text = entity.getField(MultipleFields.TEXT);
final boolean isClicked = entity.getField(MultipleFields.TAG);
final AppCompatTextView name = holder.getView(R.id.tv_vertical_item_name);
final View line = holder.getView(R.id.view_line);
final View itemView = holder.itemView;
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final int currentPosition = holder.getAdapterPosition();
if (mPrePosition != currentPosition) {
//還原上一個
getData().get(mPrePosition).setField(MultipleFields.TAG, false);
notifyItemChanged(mPrePosition);
//更新選中的item
entity.setField(MultipleFields.TAG, true);
notifyItemChanged(currentPosition);
mPrePosition = currentPosition;
final int contentId = getData().get(currentPosition).getField(MultipleFields.ID);
showContent(contentId);
}
}
});
if (!isClicked) {
line.setVisibility(View.INVISIBLE);
name.setTextColor(ContextCompat.getColor(mContext, R.color.we_chat_black));
itemView.setBackgroundColor(ContextCompat.getColor(mContext, R.color.item_background));
} else {
line.setVisibility(View.VISIBLE);
name.setTextColor(ContextCompat.getColor(mContext, R.color.app_main));
line.setBackgroundColor(ContextCompat.getColor(mContext, R.color.app_main));
itemView.setBackgroundColor(Color.WHITE);
}
holder.setText(R.id.tv_vertical_item_name, text);
break;
default:
break;
}
}