Chaudhary44
Chaudhary44

Reputation: 11

Android TextView(size set as sp) is not changing size when font size is changed from system settings

android:textSize is set to 16sp, even then the font size is fixed when system font size is increased to max.

 android:layout_width="match_parent"
 android:layout_height="wrap_content"

TextView is contained in a FrameLayout

Upvotes: 0

Views: 1344

Answers (2)

Haseeb Mirza
Haseeb Mirza

Reputation: 464

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="8dp"
    android:paddingTop="8dp"
    android:paddingRight="8dp"
    android:paddingBottom="8dp">
    
    <TextView
        android:id="@+id/item_barcode_codice_fiscale_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Font Size"
        android:textSize="80sp"/>
</FrameLayout>

Working on my side. Try to rebuild or clean the project.

enter image description here

Upvotes: 1

Amit pandey
Amit pandey

Reputation: 1195

if you want to your font size not changed according to the system font size i suggest you to use size in dp.

as you see in Decouments:

An sp is the same base unit, but is scaled by the user's preferred text size (it’s a scale-independent pixel), so you should use this measurement unit when defining text size (but never for layout sizes).

Upvotes: 0

Related Questions