I have xml file that defines some preference screens like the following example
You can simply add android:textSize
inside your theme for preference screen:
e.g :
Your SettingsActivity
class :
public class SettingsActivity extends AppCompatActivity {
private Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
toolbar = (Toolbar)findViewById(R.id.toolbar_settings);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportFragmentManager().beginTransaction()
.replace(R.id.bodylayout, new PrefsFragment())
.commit();
}
@Override
protected void onPause() {
super.onPause();
}
}
PrefsFragment
class :
public class PrefsFragment extends PreferenceFragmentCompat implements SharedPreferences.OnSharedPreferenceChangeListener {
@Override
public void onCreatePreferences(Bundle bundle, String s) {
}
@Override
public void onCreate(Bundle savedInstanceState) {
final Context myContext = this.getActivity();
//set your theme
myContext.setTheme(R.theme.settingsTheme);
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settingspreference);
//do other stuffs
}
//.....
}