1. Are you ready for the Galaxy S20? Here is everything we know so far!

dynamically changing text size

Discussion in 'Android Development' started by gavin, May 18, 2010.

  1. gavin

    gavin Lurker
    Thread Starter

    I want to allow users to choose which text size to view my app in. I have a select menu which takes the value and saves it in preferences. I am updating my TextViews in my layouts using the code below:

    Code (Text):
    1. TextView copyrightText = (TextView) findViewById(R.id.copyright);
    2. copyrightText.setTextSize(mTextSize);
    Is it possible to do the same thing for ListViews? When I uncomment the second line I get an error. I'm not sure I understand how ArrayAdapter works:

    Code (Text):
    1. TextView list_item_text = (TextView) findViewById(R.id.list_item_text);
    2.  //list_item_text.setTextSize(mTextSize);
    3.  
    4. String[] values = getResources().getStringArray(R.array.values_array);
    5. ArrayAdapter<String> mArrayAdapter = new ArrayAdapter<String>(this, R.layout.list_item, values);
    6. setListAdapter(mArrayAdapter);
    7. ListView lv = getListView();
    Thanks!
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...