先看下面这两个对话框的显示,正如你看到的,效果不一样。
而这两个对话框都是用下面这句显示的,只不过,在两个Form中调用。
MessageDlg('是否退出?', System.UITypes.TMsgDlgType.mtConfirmation,
[System.UITypes.TMsgDlgBtn.mbOK, System.UITypes.TMsgDlgBtn.mbCancel], 0,
procedure(const AResult: TModalResult)
Begin
if AResult = mrok then
Begin
.....
End;
End);
为什么会不一样呢?
问题的原因查到了,第一个样式,是因为所在的Form没有使用StyleBook,而第二个使用了StyleBook.本来我是把StyleBook的UseStyleManager设置成True,做为全局来用的,但对于MessageDlg没启到作用。这应算是XE8的一个小问题了!
该怎么解决呢?
找到FMX.Helpers.Android单元,将GetNativeTheme改成:
function GetNativeTheme: Integer;
var
LStyleDescriptor: TStyleDescription;
begin
Result := 0;
if not IsGingerbreadDevice and (Screen <> nil) and (Screen.ActiveForm <> nil)
then
begin
if (Screen.ActiveForm.StyleBook <> nil) then
begin
LStyleDescriptor := TStyleManager.FindStyleDescriptor(Screen.ActiveForm.StyleBook.Style);
Result := GetThemeFromDescriptor(LStyleDescriptor);
end
else
begin
LStyleDescriptor := TStyleManager.FindStyleDescriptor(TStyleManager.ActiveStyle(nil));
Result := GetThemeFromDescriptor(LStyleDescriptor);
end;
end;
而这两个对话框都是用下面这句显示的,只不过,在两个Form中调用。
为什么会不一样呢?
问题的原因查到了,第一个样式,是因为所在的Form没有使用StyleBook,而第二个使用了StyleBook.本来我是把StyleBook的UseStyleManager设置成True,做为全局来用的,但对于MessageDlg没启到作用。这应算是XE8的一个小问题了!
该怎么解决呢?
找到FMX.Helpers.Android单元,将GetNativeTheme改成:
function GetNativeTheme: Integer;
var
begin
end;
转自:http://blog.sina.com.cn/s/blog_44fa172f0102vgo9.html