[函數] Firemonkey Android 取得系统参数设定的字型大小

Android 系统参数设定内,可以设定字型大小:

 

可以透过下面代码来取得字型大小比例:

function FontScale: Single;
var Resources: JResources;
    Configuration: JConfiguration;
begin
     Result := 1;

     if TAndroidHelper.Context <> nil then
     begin
          Resources := TAndroidHelper.Context.getResources;
          if Resources <> nil then
          begin
               Configuration := Resources.getConfiguration;
               if Configuration <> nil then
                  Result := Configuration.fontScale;
          end;
     end;
end;

 

iOS 请参考:

Delphi 取得 iOS 辅助使用里的字型大小

posted @ 2016-10-28 08:22  龟山Aone  阅读(1099)  评论(0编辑  收藏  举报