1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram

  5. Delphifan Magazine
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Misalignment status bar on Intel based devices

Discussion in 'Delphi Android And IOS' started by AdminDF, Oct 26, 2015.

  1. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    [​IMG]One 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 Delphi iOS & Android Developers at Google Plus, managed by Lars Fosdal. Hsu Neptune pointed the solution, 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:
    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:
    [​IMG]
     
     

Share This Page