为什么所有对话框都使用“旧”对话框? Android 2.x风格? [英] Why are all the dialogs are using the "old" Android 2.x style?

查看:78
本文介绍了为什么所有对话框都使用“旧”对话框? Android 2.x风格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用RAD Studio XE7,并且想知道为什么我的Android应用程序中的所有对话框都使用旧 2.x样式?以及如何强制我的Android应用在日期选择器和MessageDlg等所有对话框中使用4.x样式?

I am currently using RAD Studio XE7 and just wondering why all the dialogs in my Android app are using the "old" 2.x style? And how to force my Android app to use the 4.x style in all the dialogs like date picker and MessageDlg?

使用StyleBook并修改AndroidManifest.xml没有工作。预先感谢。

Using StyleBook and modying the AndroidManifest.xml didn't work. Thanks in advance.

推荐答案

David I我在 Embarcadero社区答案站点:

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

为什么所有对话框都使用旧 Android 2.x样式?


我提醒我们的开发团队,他们在$ b $中发现了问题b Android帮助程序功能。这是R& D的
解决方法的回复:

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:

修复非常简单:在 FMX.Helpers.Android 是这个函数

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;


这是Embarcadero博客文章,解释了如何应用此修复程序:

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

如何为XE7对话框获取Android 4.4.x样式


在FMX.Helpers.Android.pas单元中,您需要修改GetNativeTheme函数...您将在 C:\Program Files(x86)\中找到原始源代码单元。 \Embarcadero\Studio\15.0\source\fmx文件夹。将 FMX.Helpers.Android.pas源文件复制到您的项目中,并修改该行以设置返回结果。将源文件添加到IDE中的项目中。构建您的应用程序,并查看Android KitKat设备上的现代对话框。

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.

这篇关于为什么所有对话框都使用“旧”对话框? Android 2.x风格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆