Quantcast
Channel: Delphi Forum - Delphi Programming Kings of Code - Delphi Android And IOS
Viewing all articles
Browse latest Browse all 54

Misalignment status bar on Intel based devices

$
0
0
İmageOne problem we can face when deploying for Intel based devices is a misalignment that can occurs on status bar. This issue can be observed on Bluestacks too, as you can see (that black strip is actually the status bar).After asking for help on I received a nice solution from Hsu Neptune, a member from the great community You can't view the links! Click here to register at Google Plus, managed by Lars Fosdal. Hsu Neptune pointed the You can't view the links! Click here to register, but he was kind enough to explain in plain english :)Well, there he advices that this fix should be used on Delphi XE8 (not C++ Builder – for that see the original post, bellow). I was able to ask for a test on Delphi Seattle (that also carries the same problem) and it works there. He is the fix:1. Copy FMX.Platform.Android.pas to your project’s folder and Add to the project.
2. Open FMX.Platform.Android.pas and search for ” function TWindowManager.RetrieveContentRect: TRect; ”
3. Modify the code:


 
PHP Code:
function TWindowManager.RetrieveContentRectTRect;
var
 
ActivityJActivity;
 
NativeWinJWindow;
 
DecorViewJView;
 
ContentRectVisibleContentRectJRect;
begin
 Activity 
:= SharedActivity;
 if 
Activity <> nil then
 begin
 NativeWin 
:= Activity.getWindow;
 if 
NativeWin <> nil then
 begin
 FStatusBarHeight 
:= FNewContentRect.top;
 
ContentRect := TJRect.Create;
 
DecorView := NativeWin.getDecorView;
 
DecorView.getDrawingRect(ContentRect);
 
// Fix by Flying Wang &
 
CallInUIThread(
 
procedure
 begin
 
if (not PlatformAndroid.GetFullScreen(nil)) and (SharedActivity.getWindow.getAttributes.flags and
 
TJWindowManager_LayoutParams.JavaClass.FLAG_FULLSCREEN <> TJWindowManager_LayoutParams.JavaClass.FLAG_FULLSCREENthen
 begin
 
// http://www.2cto.com/kf/201307/227536.html
 
ContentRectVisible := TJRect.Create;
 
DecorView.getWindowVisibleDisplayFrame(ContentRectVisible);
 if (
ContentRect.top 1) or (ContentRectVisible.top FStatusBarHeightthen
 begin
 ContentRect
.top := ContentRectVisible.top;
 
FNewContentRect.top := ContentRectVisible.top;
 
FStatusBarHeight := FNewContentRect.top;
 
end;
 
end;
 
end);
 
Result := TRect.Create(Round(FNewContentRect.left FScale), Round(FNewContentRect.top FScale), Round(ContentRect.right FScale),
 
Round(ContentRect.bottom FScale));
 
end;
 
end;
end
4. Re-compile the project and deployNow you will get this:
İmage
 

Viewing all articles
Browse latest Browse all 54

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>