Java Code Examples for androidx.appcompat.widget.AppCompatTextView#setTextColor()
The following examples show how to use
androidx.appcompat.widget.AppCompatTextView#setTextColor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DetailActivity.java From GetApk with MIT License | 5 votes |
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); }
Example 2
Source File: DetailActivity.java From GetApk with MIT License | 5 votes |
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); }
Example 3
Source File: StateLayoutActivity.java From ProjectX with Apache License 2.0 | 5 votes |
@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); }
Example 4
Source File: HeaderFooterGridViewActivity.java From ProjectX with Apache License 2.0 | 5 votes |
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; }
Example 5
Source File: ViewHolder.java From ProjectX with Apache License 2.0 | 5 votes |
ViewHolder(ViewGroup parent) { super(new AppCompatTextView(parent.getContext())); mVText = (AppCompatTextView) itemView; mVText.setGravity(Gravity.CENTER); mVText.setBackgroundColor(0xff00dd00); mVText.setTextColor(0xffffffff); }