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


Java AppCompatTextView.setTextColor方法代码示例

本文整理汇总了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();
}
 
开发者ID:sfilmak,项目名称:MakiLite,代码行数:18,代码来源:DownloadManagerResolver.java

示例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);

}
 
开发者ID:remerber,项目名称:FastEc,代码行数:25,代码来源:BaseBottomDelegate.java

示例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);
    }
}
 
开发者ID:remerber,项目名称:FastEc,代码行数:11,代码来源:BaseBottomDelegate.java

示例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;

}
 
开发者ID:remerber,项目名称:FastEc,代码行数:15,代码来源:BaseBottomDelegate.java

示例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;
}
 
开发者ID:KingsMentor,项目名称:Rationale,代码行数:12,代码来源:PermissionRationale.java

示例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;
    }

}
 
开发者ID:remerber,项目名称:FastEc,代码行数:52,代码来源:SortRecyclerAdapter.java


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