Android set global font size

Android changes the global font size <br> As the app becomes more and more humanized, this has caused the demand to become more and more abnormal. Here, I want to tell all my mobile development colleagues that he needs to be awkward, good, nonsense. Having said that, the following is the topic, how to change the font size globally, first AcTIvity inherits BaseacTIvity:
[java] view plain copy
Public class MainAcTIvity extends BaseAcTIvity {


@Override
Protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

Then do this in BaseActivity,
[java] view plain copy
Public class BaseActivity extends Activity {

Private int states = 3;

@Override
Protected void onCreate(Bundle savedInstanceState) {


super.onCreate(savedInstanceState);


If (1 == states) {
setTheme(R.style.Default_TextSize_Small);


} else if (2 == states) {


setTheme(R.style.Default_TextSize_Middle);
} else {
setTheme(R.style.Default_TextSize_Big);
}
}
}

In general, we adjust the global font size in the app's settings menu. Here we simulate the big, medium and small fonts as 1, 2, and 3 respectively. Obviously we use the setTheme method to control the global font size. The key point is, how to set the theme, the font size will change, let's look at the xml layout file,
[java] view plain copy
Xmlns:tools="http://schemas.android.com/tools"
Android:layout_width="match_parent"
Android:layout_height="match_parent"
Android:orientation="vertical" >

Android:layout_width="wrap_content"
Android:layout_height="wrap_content"
Android:text="@string/hello_world"
Android:textSize="?textsize" />

Android:layout_width="wrap_content"
Android:layout_height="wrap_content"
Android:text="@string/hello_world"
Android:textSize="?textsize2" />

Android:layout_width="wrap_content"
Android:layout_height="wrap_content"
Android:text="@string/hello_world"
Android:textSize="?textsize3" />


Innosilicon Miner

Innosilicon is a worldwide one-stop provider of high-speed mixed signal IPs and ASIC customization with leading market shares in Asian-Pacific market for 10 consecutive years. Its IP has enabled billions of SoC's to enter mass production, covering nodes from 180nm to 5nm across the world`s foundries including: GlobalFoundries, TSMC, Samsung, SMIC, UMC and others. Backed by its 14 years of technical expertise in developing cutting-edge IPs and ASIC products, Innosilicon has assisted our valued partners including AMD, Microchip and Microsoft to name but a few, in realizing their product goals.
Innosilicon team is fully devoted to providing the world's most advanced IP and ASIC technologies, and has achieved stellar results. In 2018, Innosilicon was the first in the world to reach mass production of the performance-leading GDDR6 interface in our cryptographic GPU product. In 2019, Innosilicon announced the availability of the HDMI v2.1 IP supporting 4K/8K displays as well as our 32Gbps SerDes PHY. In 2020, we launched the INNOLINK Chiplet which allows massive amounts of low-latency data to pass seamlessly between smaller chips as if they were all on the same bus. With a wide range of performance leading IP in multiple FinFET processes and 22nm planar processes all entering mass production, Innosilicon's remarkable innovation capabilities have been proven in fields such as: high-performance computing, high-bandwidth memory, encrypted computing, AI cloud computing, and low-power IoT.

Innosilicon Miner:Innosilicon A4+ LTCMaster,Innosilicon A6+ LTCMaster,Innosilicon A6 LTCMaster

Ltcmaster,innosilicon ltcmaster,innosilicon ltc miner,Innosilicon a4,Innosilicon a6

Shenzhen YLHM Technology Co., Ltd. , https://www.ylhm-tech.com