當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。