In my application, i want to provide add font size in setting preferences for example 18, 20, 22, so that is user selects 20 then whole application should use that font size only. How to achieve this?
Asked
Active
Viewed 3,746 times
1 Answers
2
you can define a setting code in your forms and do like this:
private void loadSettings() {
//load font from global unit named G
G.typeFace = Typeface.createFromAsset(getAssets(), "fonts/BYekan.ttf");
TextView titleText = (TextView) findViewById(R.id.reg_title);
TextView regTitleText = (TextView) findViewById(R.id.reg_title);
TextView bigText = (TextView) findViewById(R.id.textView_big);
TextView button_titlet = (TextView) findViewById(R.id.reg_botton_title);
btnReg = (Button) findViewById(R.id.btn_reg);
titleText.setTypeface(G.typeFace);
bigText.setTypeface(G.typeFace);
regTitleText.setTypeface(G.typeFace);
button_titlet.setTypeface(G.typeFace);
btnReg.setTypeface(G.typeFace);
titleText.setTextSize(20);
bigText.setTextSize(20);
regTitleText.setTextSize(20);
button_titlet.setTextSize(20);
btnReg.setTextSize(20);
//end of fonts
}

Mahdi
- 6,139
- 9
- 57
- 109