Changing font size into an AlertDialog

后端 未结 7 2206
广开言路
广开言路 2020-12-04 22:10

I am trying to put some loooong text into an AlertDialog. The only issue the default font size that is really too big, so I want to make it smaller.

Here are all the

相关标签:
7条回答
  • 2020-12-04 22:47

    Here is my solution... you need to create the scroll container, then add the TextView inside the ScrollView just as you would in the XML layout.

    AlertDialog alertDialog = new AlertDialog.Builder(this).create();
    String str = getString(R.string.upgrade_notes); 
    final ScrollView s_view = new ScrollView(getApplicationContext());
    final TextView t_view = new TextView(getApplicationContext());
    t_view.setText(str);
    t_view.setTextSize(14);     
    s_view.addView(t_view);
    alertDialog.setTitle("Upgrade notes!");
    alertDialog.setView(s_view);
    
    0 讨论(0)
提交回复
热议问题