Java Code Examples for androidx.appcompat.widget.AppCompatTextView#setTextSize()

The following examples show how to use androidx.appcompat.widget.AppCompatTextView#setTextSize() . 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: ThemeView.java    From SAI with GNU General Public License v3.0 6 votes vote down vote up
private void init() {
    LinearLayoutCompat container = new LinearLayoutCompat(getContext());
    container.setOrientation(LinearLayoutCompat.VERTICAL);
    MaterialCardView.LayoutParams containerLayoutParams = new MaterialCardView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    containerLayoutParams.gravity = Gravity.CENTER;
    addView(container, containerLayoutParams);

    mThemeTitle = new AppCompatTextView(getContext());
    mThemeTitle.setGravity(Gravity.CENTER);
    mThemeTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
    LinearLayoutCompat.LayoutParams titleLayoutParams = new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    container.addView(mThemeTitle, titleLayoutParams);

    mThemeMessage = new AppCompatTextView(getContext());
    mThemeMessage.setGravity(Gravity.CENTER);
    mThemeMessage.setVisibility(GONE);
    LinearLayoutCompat.LayoutParams messageLayoutParams = new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    container.addView(mThemeMessage, messageLayoutParams);
}
 
Example 2
Source File: DetailActivity.java    From GetApk with MIT License 5 votes vote down vote up
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 3
Source File: DetailActivity.java    From GetApk with MIT License 5 votes vote down vote up
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 4
Source File: DownloadManagerResolver.java    From hipda with GNU General Public License v2.0 5 votes vote down vote up
private static AlertDialog createDialog(final Context context) {
    AppCompatTextView messageTextView = new AppCompatTextView(context);
    messageTextView.setTextSize(16f);
    messageTextView.setText("下载管理器已停用,请启用");
    return new AlertDialog.Builder(context)
            .setView(messageTextView, 50, 30, 50, 30)
            .setPositiveButton(context.getResources().getString(android.R.string.ok), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    enableDownloadManager(context);
                }
            })
            .setCancelable(false)
            .create();
}
 
Example 5
Source File: StateLayoutActivity.java    From ProjectX with Apache License 2.0 5 votes vote down vote up
@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 6
Source File: RecyclePagerActivity.java    From ProjectX with Apache License 2.0 4 votes vote down vote up
Holder(Context context) {
    super(new AppCompatTextView(context));
    final AppCompatTextView text = (AppCompatTextView) itemView;
    text.setGravity(Gravity.CENTER);
    text.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 128);
}