How to set font scale in my own android application?

后端 未结 3 506
名媛妹妹
名媛妹妹 2020-12-30 15:10

I want to allow user select font size.

Spare Parts do provide the feature to do that,

ActivityManagerNative.getDefault().updateConfiguratio

3条回答
  •  失恋的感觉
    2020-12-30 15:33

    Translated for Xamarin....

            Android.Content.Res.Configuration configuration = Resources.Configuration;
            configuration.FontScale = (float)1; //0.85 small size, 1 normal size, 1,15 big etc
    
            Android.Util.DisplayMetrics metrics = new DisplayMetrics();
            this.WindowManager.DefaultDisplay.GetMetrics(metrics);
            metrics.ScaledDensity = configuration.FontScale * metrics.Density;
    

提交回复
热议问题