1. Check out our companion app, Forums for Android! Download from Google Play

dynamically changing text size

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

  1. gavin

    gavin New Member
    Thread Starter
    5

    May 18, 2010
    1
    0
    5
    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!
     

    Advertisement

Share This Page

Loading...