简体   繁体   中英

How to change the font size of only for one textview in a setting ( listview)?

I am creating a chatting app for a school project and I need to add a list of choices between three different font sizes in the SettingActivity, so you can switch between font sizes whenever you like. It only needs to affect the chat and thus not the whole app. I am lost from here.

Save the font size in shared prefrences when user goes to setting activity ,

In the chat listview use an adapter that will check the size prefrences when it initialize the list , than define the textviews in that size using this:

     holder.textView.setTextSize(TypedValue.COMPLEX_UNIT_SP,YOUR_NEW_SIZE);

Enjoy.

use the following XML files......

<com.mobsandgeeks.ui.TypefaceTextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello_world"
    geekui:customTypeface="fonts/custom_font.ttf" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM