1. Download our Official Android App: Forums for Android!

Apps dynamically changing text size

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

  1. gavin

    gavin Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    1
    Joined:
    May 18, 2010

    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...