I have an hybrid app and if users change the font size with settings of mobile, I have some problem with the layout.
So, I would like that the font-size doesn't change with settings.
I have searched a lot and I have tried to do this:
1. In res > values > strings.xml
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="app_name">My App</string>
<string name="launcher_name">@string/app_name</string>
<string name="activity_name">@string/launcher_name</string>
<style name="MyTheme" parent="android:Theme">
<item name="android:textViewStyle">@style/MyTextView</item>
</style>
<style name="MyTextView" parent="android:Widget.TextView">
<item name="android:textSize">22dp</item>
</style>
</resources>
In AndroidManifest.xml
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="1.0" package="com.app.myapp" xmlns:android="http://schemas.android.com/apk/res/android"> <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true"> <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@style/MyTheme" android:windowSoftInputMode="adjustResize"> <intent-filter android:label="@string/launcher_name"> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="26" /> </manifest>
But this doesn't work and I don't understand why.
Where am I doing wrong?