Java Code Examples for android.widget.TextView.setTextColor()

The following are Jave code examples for showing how to use setTextColor() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: NeiHanDuanZiTV   File: LoadingView.java   View Source Code Vote up 6 votes
public LoadingView showLoading(CharSequence msg, boolean cancleabl) {

        mDialog = new Dialog(mContext);// TODO: 2017/8/28 内存泄露时这里也修改为弱引用
        mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

        rootView = View.inflate(mContext, R.layout.dialogui_loading_horizontal, null);
        mLinearLayout = (LinearLayout) rootView.findViewById(R.id.dialogui_ll_bg);
        mProgressBar = (ProgressBar) rootView.findViewById(R.id.pb_bg);
        mTextView = (TextView) rootView.findViewById(R.id.dialogui_tv_msg);
        mTextView.setText(msg);
        mLinearLayout.setBackgroundResource(R.drawable.dialogui_shape_wihte_round_corner);
        mProgressBar.setIndeterminateDrawable(mContext.getResources().getDrawable(R.drawable.dialogui_shape_progress));
        mTextView.setTextColor(mContext.getResources().getColor(R.color.text_black));
        mDialog.setContentView(rootView);

        if (mDialog != null) {
            if (mDialog.isShowing()) {
                mDialog.dismiss();
            }
            mDialog.setCancelable(cancleabl);
            mDialog.setOnCancelListener(this);
            mDialog.show();
        }
        return this;
    }
 
Example 2
Project: GongXianSheng   File: SwipeMenuView.java   View Source Code Vote up 5 votes
private TextView createTitle(SwipeMenuItem item) {
	TextView tv = new TextView(getContext());
	tv.setText(item.getTitle());
	tv.setGravity(Gravity.CENTER);
	tv.setTextSize(item.getTitleSize());
	tv.setTextColor(item.getTitleColor());
	return tv;
}
 
Example 3
Project: HueNotifier   File: RuleAdapter.java   View Source Code Vote up 5 votes
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
    Rule rule = activity.rules.get(position);
    holder.text.setText(rule.appName);
    holder.edit.setVisibility(View.GONE);
    Drawable appIcon;
    try {
        appIcon = pm.getApplicationIcon(rule.appPkg);
        appIcon.setBounds(0, 0, Util.dpToPx(activity, 25),
                Util.dpToPx(activity, 25));
    } catch (PackageManager.NameNotFoundException e) {
        appIcon = null;
    }
    holder.text.setCompoundDrawables(appIcon, null, null, null);
    holder.linearLayout.removeAllViews();
    for (int i = 0; i < rule.lightSettings.lights.length; i++) {
        TextView light = (TextView) inflater
                .inflate(R.layout.light, holder.linearLayout, false);
        int lightIcon;
        if (activity.lights != null && activity.lights.containsKey(
                String.valueOf(rule.lightSettings.lights[i]))) {
            Light lightObject = activity.lights.get(
                    String.valueOf(rule.lightSettings.lights[i]));
            light.setText(lightObject.name);
            lightIcon = Util.getLightIcon(lightObject.modelid);
        } else {
            light.setText("Light #" + rule.lightSettings.lights[i]);
            lightIcon = R.drawable.ic_light;
        }
        light.setCompoundDrawablesWithIntrinsicBounds(lightIcon, 0, 0, 0);
        if (Build.VERSION.SDK_INT >= 23) {
            API23Wrapper.setCompoundDrawableTintList(light, rule.lightSettings.colors[i]);
        }
        light.setTextColor(rule.lightSettings.colors[i]);
        holder.linearLayout.addView(light);
    }
}
 
Example 4
Project: HotFixDemo   File: MainActivity.java   View Source Code Vote up 5 votes
public void show_info(View view) {
    // add more Build Info
    final StringBuilder sb = new StringBuilder();
    Tinker tinker = Tinker.with(getApplicationContext());
    if (tinker.isTinkerLoaded()) {
        sb.append(String.format("[patch is loaded] \n"));
        sb.append(String.format("[buildConfig TINKER_ID] %s \n", BuildInfo.TINKER_ID));
        sb.append(String.format("[buildConfig BASE_TINKER_ID] %s \n", BaseBuildInfo.BASE_TINKER_ID));

        sb.append(String.format("[buildConfig MESSSAGE] %s \n", BuildInfo.MESSAGE));
        sb.append(String.format("[TINKER_ID] %s \n", tinker.getTinkerLoadResultIfPresent().getPackageConfigByName(ShareConstants.TINKER_ID)));
        sb.append(String.format("[packageConfig patchMessage] %s \n", tinker.getTinkerLoadResultIfPresent().getPackageConfigByName("patchMessage")));
        sb.append(String.format("[TINKER_ID Rom Space] %d k \n", tinker.getTinkerRomSpace()));

    } else {
        sb.append(String.format("[patch is not loaded] \n"));
        sb.append(String.format("[buildConfig TINKER_ID] %s \n", BuildInfo.TINKER_ID));
        sb.append(String.format("[buildConfig BASE_TINKER_ID] %s \n", BaseBuildInfo.BASE_TINKER_ID));

        sb.append(String.format("[buildConfig MESSSAGE] %s \n", BuildInfo.MESSAGE));
        sb.append(String.format("[TINKER_ID] %s \n", ShareTinkerInternals.getManifestTinkerID(getApplicationContext())));
    }
    sb.append(String.format("[BaseBuildInfo Message] %s \n", BaseBuildInfo.TEST_MESSAGE));

    final TextView v = new TextView(this);
    v.setText(sb);
    v.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
    v.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 10);
    v.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    v.setTextColor(0xFF000000);
    v.setTypeface(Typeface.MONOSPACE);
    final int padding = 16;
    v.setPadding(padding, padding, padding, padding);

    final AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setCancelable(true);
    builder.setView(v);
    final AlertDialog alert = builder.create();
    alert.show();
}
 
Example 5
Project: SlidingSwitch   File: SlidingSwitch.java   View Source Code Vote up 5 votes
private TextView buildTextView(Context context, CharSequence text) {
    TextView textView = new TextView(context);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.MATCH_PARENT, 1);
    textView.setLayoutParams(params);
    textView.setTextColor(mTextColor);
    textView.setText(text);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, mTextSize);
    textView.setMaxLines(3);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    textView.setGravity(Gravity.CENTER);
    textView.setPadding(mPaddingHorizontal, mPaddingVertical, mPaddingHorizontal, mPaddingVertical);
    return textView;
}
 
Example 6
Project: decoy   File: BlackListActivity.java   View Source Code Vote up 5 votes
private void findViews() {
    TextView notifyText = ((TextView) findView(R.id.notify_bar).findViewById(R.id.status_desc_label));
    notifyText.setText(R.string.black_list_tip);
    notifyText.setBackgroundColor(getResources().getColor(R.color.color_yellow_fcf3cd));
    notifyText.setTextColor(getResources().getColor(R.color.color_yellow_796413));
    listView = findView(R.id.black_list_view);
    adapter = new BlackListAdapter(this, data, this, viewHolderEventListener);
    listView.setAdapter(adapter);
}
 
Example 7
Project: airgram   File: BottomSheet.java   View Source Code Vote up 5 votes
public BottomSheetCell(Context context, int type) {
    super(context);

    setBackgroundResource(R.drawable.list_selector);
    setPadding(AndroidUtilities.dp(16), 0, AndroidUtilities.dp(16), 0);

    imageView = new ImageView(context);
    imageView.setScaleType(ImageView.ScaleType.CENTER);
    addView(imageView, LayoutHelper.createFrame(24, 24, Gravity.CENTER_VERTICAL | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT)));

    textView = new TextView(context);
    textView.setLines(1);
    textView.setSingleLine(true);
    textView.setGravity(Gravity.CENTER_HORIZONTAL);
    textView.setEllipsize(TextUtils.TruncateAt.END);
    if (type == 0) {
        textView.setTextColor(0xff212121);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
        addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL));
    } else if (type == 1) {
        textView.setGravity(Gravity.CENTER);
        textView.setTextColor(0xff212121);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
        textView.setTypeface(FontManager.instance().getTypeface());
        addView(textView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    }
}
 
Example 8
Project: CIA   File: ExpandableListViewAdapter.java   View Source Code Vote up 5 votes
/**
 * Get the text display for a specified habit category in the list
 * @param i the index of the habit category
 * @param b (unused)
 * @param view (unused)
 * @param parent (unused)
 * @return the view displaying the specified habit category in the list
 */
@Override
public View getGroupView(int i, boolean b, View view, ViewGroup parent) {
    TextView textView = new TextView(context);
    textView.setText((String)getGroup(i));
    textView.setPadding(100, 36, 10, 36);
    textView.setTextColor(Color.BLACK);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
    return textView;
}
 
Example 9
Project: Android-SteamVR-controller   File: ControllerFragment.java   View Source Code Vote up 5 votes
private void OnControlActivatedEvent(TextView label, boolean down) {
    if (down) {
        label.setTextColor(getResources().getColor(R.color.text_color_highlighted));
    }
    else {
        label.setTextColor(getResources().getColor(R.color.text_color));
    }
}
 
Example 10
Project: PlusGram   File: TextInfoCell.java   View Source Code Vote up 5 votes
public TextInfoCell(Context context) {
    super(context);

    textView = new TextView(context);
    textView.setTextColor(0xffa3a3a3);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13);
    textView.setGravity(Gravity.CENTER);
    textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
    textView.setPadding(0, AndroidUtilities.dp(19), 0, AndroidUtilities.dp(19));
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER, 17, 0, 17, 0));
}
 
Example 11
Project: EasyAndroid   File: AuthEditText.java   View Source Code Vote up 5 votes
/**
 * 设置文本颜色
 */
public void setTextColor(@ColorInt int color)
{
    this.textColor = color;
    for(TextView tv : list)
    {
        tv.setTextColor(color);
    }
}
 
Example 12
Project: DoApp   File: CounterActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_counter);

    tv = (TextView) findViewById(R.id.textView3);
    tv.setText(getIntent().getStringExtra("msg"));
    tv.setTextColor(Color.WHITE);
}
 
Example 13
Project: TextEmoji   File: FriendListItem.java   View Source Code Vote up 5 votes
public FriendListItem(Context context, float ratio) {
	super(context);
	int itemPadding = (int) (ratio * DESIGN_ITEM_PADDING);
	setPadding(itemPadding, 0, itemPadding, 0);
	setMinimumHeight((int) (ratio * DESIGN_ITEM_HEIGHT));
	setBackgroundColor(0xffffffff);

	ivCheck = new ImageView(context);
	LayoutParams lp = new LayoutParams(
			LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	addView(ivCheck, lp);

	aivIcon = new AsyncImageView(context);
	int avatarWidth = (int) (ratio * DESIGN_AVATAR_WIDTH);
	lp = new LayoutParams(avatarWidth, avatarWidth);
	lp.gravity = Gravity.CENTER_VERTICAL;
	int avatarMargin = (int) (ratio * DESIGN_AVATAR_PADDING);
	lp.setMargins(avatarMargin, 0, avatarMargin, 0);
	addView(aivIcon, lp);

	tvName = new TextView(context);
	tvName.setTextColor(0xff000000);
	tvName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
	tvName.setSingleLine();
	lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp.gravity = Gravity.CENTER_VERTICAL;
	lp.weight = 1;
	addView(tvName, lp);

	int resId = ResHelper.getBitmapRes(context, "ssdk_oks_classic_check_checked");
	if (resId > 0) {
		bmChd = BitmapFactory.decodeResource(context.getResources(), resId);
	}
	resId = ResHelper.getBitmapRes(getContext(), "ssdk_oks_classic_check_default");
	if (resId > 0) {
		bmUnch = BitmapFactory.decodeResource(context.getResources(), resId);
	}
}
 
Example 14
Project: BizareChat   File: PublicDialogsFragment.java   View Source Code Vote up 5 votes
@Override
public void showNetworkError() {
    if (connProblemSnack == null) {
        connProblemSnack = TSnackbar.make(recyclerView,
                R.string.main_connection_problem, TSnackbar.LENGTH_SHORT);
        connProblemSnack.getView().setBackgroundColor(getResources()
                .getColor(R.color.main_screen_connection_problem_background));
        TextView message = (TextView) connProblemSnack.getView()
                .findViewById(com.androidadvance.topsnackbar.R.id.snackbar_text);
        message.setTextColor(getResources().getColor(R.color.main_screen_connection_problem_text));
        message.setGravity(Gravity.CENTER);
    }
    connProblemSnack.show();
}
 
Example 15
Project: Veggietizer   File: AchievementAdapter.java   View Source Code Vote up 5 votes
@Override
public View getView(int position, View convertView, ViewGroup parent) {
	View row = convertView;

       if(row == null) {
           LayoutInflater inflater = ((Activity)context).getLayoutInflater();
           row = inflater.inflate(layoutResourceId, parent, false);
       }

       Typeface font = FontManager.getInstance().getFont(FontManager.Font.ROBOTO_LIGHT);
       TextView title = (TextView) row.findViewById(R.id.achievement_title);
       title.setTypeface(font);
       ImageView icon = (ImageView) row.findViewById(R.id.achievement_icon);

       title.setText(achievements[position].getHeading());

       if(achievements[position].checkAchievement()) {
           icon.setImageResource(achievements[position].getIconUnlockedID());
           title.setTextColor(Color.BLACK);
       }
   	else {
           icon.setImageResource(achievements[position].getIconLockedID());
           title.setTextColor(context.getResources().getColor(R.color.text_gray));
       }

       return row;
}
 
Example 16
Project: PleaseWakeUp   File: RedirectActivity.java   View Source Code Vote up 5 votes
@Override
protected void onCreate(Bundle arg0) {
    super.onCreate(arg0);
    TextView tv = new TextView(this);
    tv.setText("url:" + getIntent().getData());
    tv.setTextColor(Color.BLACK);
    setContentView(tv);
    Log.d(TAG, ">>>>>>>>>>>>>>>>onCreate");
}
 
Example 17
Project: PWEditText-SafeKeyboard   File: SafetyKeyboard.java   View Source Code Vote up 4 votes
@Override
public View getView(int position, View convertView, ViewGroup parent) {

    if (LayoutParams.MATCH_PARENT != mWidth) {
        mKeyWidth = (mWidth - 2 * mMarginCol - mPaddingLeft
                - mPaddingRight) / 3;
    }
    mKeyHeight = (mHeight - mTitleHeight - mPaddingTop - mPaddingBottom
            - 3 * mMarginRow) / 4;
    ImageButton buttonView = new ImageButton(mContext);
    buttonView.setScaleType(ScaleType.CENTER_INSIDE);
    buttonView.setLayoutParams(
            new AbsListView.LayoutParams(mKeyWidth, mKeyHeight));

    TextView textView = new TextView(mContext);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        textView.setTextColor(
                mContext.getResources().getColor(mNumColor));
    } else {
        textView.setTextColor(mNumColor);
    }
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, mNumSize);
    textView.setGravity(Gravity.CENTER);
    textView.setLayoutParams(
            new AbsListView.LayoutParams(mKeyWidth, mKeyHeight));
    if (!mIsAudio) {
        buttonView.setSoundEffectsEnabled(false);
        textView.setSoundEffectsEnabled(false);
    }

    long id = getItemId(position);
    String key = (String) getItem(position);
    if (Constant.CONFIRM_BUTTON_ITEM_ID == id) {
        if (null != mDoneForeSelector && null != mDoneBgSelector) {
            setDoneKey(buttonView);
        } else {
            setDefaultDoneDelKey(textView);
            String doneKeyStr = mContext.getResources()
                    .getString(R.string.str_done);
            textView.setText(doneKeyStr);
            int doneKeyColor = mContext.getResources()
                    .getColor(R.color.btn_security_keyboard_done);

            textView.setTextColor(doneKeyColor);
            int doneBackGroundColor = mContext.getResources()
                    .getColor(R.color.bg_security_keyboard_title);
            textView.setBackgroundColor(doneBackGroundColor);
            textView.setTextSize(16);
            textView.setId((int) getItemId(position));
            textView.setOnClickListener(onPasswordButtonClickListener);
            return textView;
        }
    } else if (Constant.DELETE_BUTTON_ITEM_ID == id) {
        if (null != mDelForeSelector || null != mDelBgSelector) {
            setDelKey(buttonView);
        } else {
            textView.setText(key);
            setDefaultDoneDelKey(textView);
            textView.setId((int) getItemId(position));
            textView.setOnClickListener(onPasswordButtonClickListener);
            return textView;
        }
    } else {
        if (null != mNumForeSelectorArray) {
            setNumberKey(buttonView, (int) id);
        } else {
            setDefaultNumKey(textView, (int) id);
            textView.setId((int) getItemId(position));
            textView.setOnClickListener(onPasswordButtonClickListener);
            return textView;
        }
    }
    buttonView.setId((int) getItemId(position));
    buttonView.setOnClickListener(onPasswordButtonClickListener);
    return buttonView;
}
 
Example 18
Project: letv   File: LiveSubTypeLunboActivity.java   View Source Code Vote up 4 votes
private void initSecondaryTabs() {
    this.mHeadTitleView = UIsUtils.inflate(getActivity(), R.layout.half_lunbo_title, null);
    this.mTabTitleContainer = (LinearLayout) this.mHeadTitleView.findViewById(R.id.tabTitleContainer);
    LayoutParams tabTitlParams = new LayoutParams(-1, -2);
    tabTitlParams.height = UIsUtils.zoomWidth(40);
    this.mTabTitleContainer.setLayoutParams(tabTitlParams);
    String[] titles = getResources().getStringArray(R.array.channel_Titles);
    int j = titles.length;
    this.mTitleList = new ArrayList();
    for (int i = 0; i < j; i++) {
        RelativeLayout titleRelative = new RelativeLayout(getActivity());
        LayoutParams params = new LayoutParams(-1, -2);
        params.weight = 1.0f;
        titleRelative.setLayoutParams(params);
        TextView text = new TextView(getActivity());
        text.setBackgroundColor(getActivity().getResources().getColor(2131492949));
        text.setLayoutParams(new RelativeLayout.LayoutParams(-1, -1));
        text.setGravity(17);
        text.setTextSize(1, 15.0f);
        text.setText(titles[i]);
        text.setTag(Integer.valueOf(i));
        if (i == 1) {
            this.mCurrentSelectTab = text;
            text.setTextColor(getResources().getColor(2131493202));
        } else {
            text.setTextColor(getResources().getColor(2131493022));
        }
        text.setOnClickListener(this.mTabClickListener);
        titleRelative.addView(text);
        this.mTabTitleContainer.addView(titleRelative);
        if (i < j - 1) {
            View lineView = new View(getActivity());
            lineView.setBackgroundColor(getResources().getColor(2131493321));
            RelativeLayout.LayoutParams lineParams = new RelativeLayout.LayoutParams(-1, -1);
            lineParams.width = 1;
            lineParams.height = UIsUtils.zoomWidth(24);
            lineView.setLayoutParams(lineParams);
            this.mTabTitleContainer.addView(lineView);
        }
        this.mTitleList.add(titleRelative);
    }
    this.mSaveLinearLayout = (LinearLayout) this.mHeadTitleView.findViewById(R.id.saveRootLinear);
    LinearLayout saveChildLayout = (LinearLayout) this.mHeadTitleView.findViewById(R.id.saveChildLinear);
    LayoutParams saveLinearParams = (LayoutParams) saveChildLayout.getLayoutParams();
    saveLinearParams.height = UIsUtils.zoomWidth(65);
    saveChildLayout.setLayoutParams(saveLinearParams);
    saveChildLayout.setPadding(UIsUtils.zoomWidth(15), 0, 0, 0);
    this.mSaveLinearLayout.setOnClickListener(this.mAddToFavariteListener);
    this.mListView.addHeaderView(this.mHeadTitleView);
}
 
Example 19
Project: GitHub   File: CommonTabLayout.java   View Source Code Vote up 4 votes
private void updateTabStyles() {
        for (int i = 0; i < mTabCount; i++) {
            View tabView = mTabsContainer.getChildAt(i);
            tabView.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0);
            TextView tv_tab_title = (TextView) tabView.findViewById(R.id.tv_tab_title);
            tv_tab_title.setTextColor(i == mCurrentTab ? mTextSelectColor : mTextUnselectColor);
            tv_tab_title.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextsize);
//            tv_tab_title.setPadding((int) mTabPadding, 0, (int) mTabPadding, 0);
            if (mTextAllCaps) {
                tv_tab_title.setText(tv_tab_title.getText().toString().toUpperCase());
            }

            if (mTextBold == TEXT_BOLD_BOTH) {
                tv_tab_title.getPaint().setFakeBoldText(true);
            } else if (mTextBold == TEXT_BOLD_NONE) {
                tv_tab_title.getPaint().setFakeBoldText(false);
            }

            ImageView iv_tab_icon = (ImageView) tabView.findViewById(R.id.iv_tab_icon);
            if (mIconVisible) {
                iv_tab_icon.setVisibility(View.VISIBLE);
                CustomTabEntity tabEntity = mTabEntitys.get(i);
                iv_tab_icon.setImageResource(i == mCurrentTab ? tabEntity.getTabSelectedIcon() : tabEntity.getTabUnselectedIcon());
                LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                        mIconWidth <= 0 ? LinearLayout.LayoutParams.WRAP_CONTENT : (int) mIconWidth,
                        mIconHeight <= 0 ? LinearLayout.LayoutParams.WRAP_CONTENT : (int) mIconHeight);
                if (mIconGravity == Gravity.LEFT) {
                    lp.rightMargin = (int) mIconMargin;
                } else if (mIconGravity == Gravity.RIGHT) {
                    lp.leftMargin = (int) mIconMargin;
                } else if (mIconGravity == Gravity.BOTTOM) {
                    lp.topMargin = (int) mIconMargin;
                } else {
                    lp.bottomMargin = (int) mIconMargin;
                }

                iv_tab_icon.setLayoutParams(lp);
            } else {
                iv_tab_icon.setVisibility(View.GONE);
            }
        }
    }
 
Example 20
Project: Musicoco   File: ViewUtils.java   View Source Code Vote up 4 votes
/**
 * @param colors length 为 4 的颜色值数组,0..4 分别对应 <br>
 *               收藏图标着色
 *               取消收藏图标着色
 *               收藏文字颜色
 *               取消收藏文字颜色
 *               中间线条颜色
 */
public static View getSelectFavoriteOptionsView(Context context,
                                                @Nullable View.OnClickListener favorite,
                                                @Nullable View.OnClickListener cancelFavorite,
                                                @NonNull int[] colors) {
    if (colors.length != 5) {
        return null;
    }

    int favoriteIC = colors[0];
    int notFavoriteIC = colors[1];
    int favoriteTC = colors[2];
    int notFavoriteTC = colors[3];
    int lineC = colors[4];

    View view = LayoutInflater.from(context).inflate(R.layout.select_favorite_options, null);

    ImageView fit = (ImageView) view.findViewById(R.id.select_favorite_true);
    ImageView fif = (ImageView) view.findViewById(R.id.select_favorite_false);
    TextView ftt = (TextView) view.findViewById(R.id.select_favorite_tv_true);
    TextView ftf = (TextView) view.findViewById(R.id.select_favorite_tv_false);
    View line = view.findViewById(R.id.select_favorite_line);

    line.setBackgroundColor(lineC);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        fit.getDrawable().setTint(favoriteIC);
        fif.getDrawable().setTint(notFavoriteIC);
    }

    ftt.setTextColor(favoriteTC);
    ftf.setTextColor(notFavoriteTC);

    if (favorite != null) {
        fit.setOnClickListener(favorite);
    }

    if (cancelFavorite != null) {
        fif.setOnClickListener(cancelFavorite);
    }

    return view;
}