Why are all the dialogs are using the “old” Android 2.x style?

笑着哭i 提交于 2019-11-30 15:44:49

David I posted the answer to your same question on the Embarcadero Community Answers site:

Why all the dialogs are using the "old" Android 2.x style?

I alerted our development team and they found the problem in an Android helper function. Here is the reply from R&D with the workaround:

The fix is very simple : In FMX.Helpers.Android it’s this function

function GetNativeTheme: Integer;
var
  LStyleDescriptor: TStyleDescription;
begin
  Result := 0;
  if not IsGingerbreadDevice and (Screen <> nil) and (Screen.ActiveForm <> nil) and (Screen.ActiveForm.StyleBook <> nil) then
  begin
    LStyleDescriptor := TStyleManager.FindStyleDescriptor(Screen.ActiveForm.StyleBook.Style);
    // GetThemeFromDescriptor(LStyleDescriptor);
    Result := GetThemeFromDescriptor(LStyleDescriptor); // <--here the result assignment was missing
  end;
end;

And here is an Embarcadero blog post explaining how to apply the fix:

How to get Android 4.4.x style for your XE7 dialog boxes

In the FMX.Helpers.Android.pas unit, you need to modify the GetNativeTheme function... You will find the original source code unit in the "C:\Program Files (x86)\Embarcadero\Studio\15.0\source\fmx" folder.  Copy the "FMX.Helpers.Android.pas" source file to your project and modify the line to set the return Result. Add the source file to your project in the IDE. Build your app and see the modern dialog boxes on your Android KitKat devices.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!