【问题标题】:Why are all the dialogs are using the "old" Android 2.x style?为什么所有对话框都使用“旧”的 Android 2.x 样式?
【发布时间】:2015-02-24 04:18:11
【问题描述】:

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

使用样书和修改 AndroidManifest.xml 不起作用。提前致谢。

【问题讨论】:

  • 您的设备上有什么?安卓2.x?对话框可能是原生的,不是 Firemonkey 制作的。

标签: delphi firemonkey delphi-xe7 appmethod


【解决方案1】:

David 我在Embarcadero Community Answers 网站上发布了您相同问题的答案:

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

我通知了我们的开发团队,他们发现问题在于 安卓助手功能。这是R&D的回复 解决方法:

修复很简单:FMX.Helpers.Android 就是这个函数

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 博客文章,解释了如何应用修复:

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

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

【讨论】:

  • 如何为 TCombobox 的项目选择对话框获取 Android 4.4.x 样式?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-03-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多