androidx.appcompat.widget.AppCompatTextView#setTextColor ( )源码实例Demo

下面列出了androidx.appcompat.widget.AppCompatTextView#setTextColor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: GetApk   文件: DetailActivity.java
private void addParentView(String str) {
    AppCompatTextView textView = new AppCompatTextView(this);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.topMargin = SizeUtil.dp2pxSize(this, 8);
    textView.setTextSize(15);
    textView.setText(str);
    textView.setTextColor(ContextCompat.getColor(this, R.color.colorPrimary));
    mInfoParent.addView(textView, params);
}
 
源代码2 项目: GetApk   文件: DetailActivity.java
private void addParent2View(String str) {
    AppCompatTextView textView = new AppCompatTextView(this);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.topMargin = SizeUtil.dp2pxSize(this, 4);
    params.setMarginStart(SizeUtil.dp2pxSize(this, 6));
    textView.setTextSize(15);
    textView.setText(str);
    textView.setTextColor(ContextCompat.getColor(this, R.color.blue500));
    mInfoParent.addView(textView, params);
}
 
源代码3 项目: ProjectX   文件: StateLayoutActivity.java
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setSupportActionBar(R.id.sl_toolbar);
    mVState = findViewById(R.id.sl_lyt_state);
    final RadioGroup state = findViewById(R.id.sl_rg_state);
    final RadioGroup mode = findViewById(R.id.sl_rg_mode);
    mDLoading = ContextCompat.getDrawable(this, R.drawable.ic_statelayout_loading);
    mDError = ContextCompat.getDrawable(this, R.drawable.ic_statelayout_error);
    mDEmpty = ContextCompat.getDrawable(this, R.drawable.ic_statelayout_empty);
    final CircularProgressImageView loading = new CircularProgressImageView(this);
    loading.setColorSchemeColors(
            ContextCompat.getColor(this, android.R.color.holo_red_light),
            ContextCompat.getColor(this, android.R.color.holo_blue_light),
            ContextCompat.getColor(this, android.R.color.holo_green_light),
            ContextCompat.getColor(this, android.R.color.holo_orange_light),
            ContextCompat.getColor(this, android.R.color.holo_purple));
    mVLoading = loading;
    final AppCompatTextView error = new AppCompatTextView(this);
    error.setText(R.string.sl_change_state_error);
    error.setTextColor(0xffff4081);
    error.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 64);
    mVError = error;
    final AppCompatTextView empty = new AppCompatTextView(this);
    empty.setText(R.string.sl_change_state_empty);
    empty.setTextColor(0xff092d6d);
    empty.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 64);
    mVEmpty = empty;

    state.setOnCheckedChangeListener(this);
    state.check(R.id.sl_rb_normal);
    mode.setOnCheckedChangeListener(this);
    mode.check(R.id.sl_rb_drawable);

    mVState.setOnClickListener(this);
}
 
源代码4 项目: ProjectX   文件: HeaderFooterGridViewActivity.java
private AppCompatTextView createTextView(Context context) {
    final float density = context.getResources().getDisplayMetrics().density;
    AppCompatTextView text = new AppCompatTextView(context);
    text.setTextColor(0xff999999);
    text.setGravity(Gravity.CENTER);
    text.setMinimumWidth((int) (64 * density));
    text.setMinimumHeight((int) (48 * density));
    text.setBackgroundResource(R.drawable.bg_headerfootergridview_item);
    return text;
}
 
源代码5 项目: ProjectX   文件: ViewHolder.java
ViewHolder(ViewGroup parent) {
    super(new AppCompatTextView(parent.getContext()));
    mVText = (AppCompatTextView) itemView;
    mVText.setGravity(Gravity.CENTER);
    mVText.setBackgroundColor(0xff00dd00);
    mVText.setTextColor(0xffffffff);
}