Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Android DrawerLayout, MapView, button with top margin and translucent statusbar glitch. #1894

Closed

Description

@erf

This is a pretty complex issue, but i think i have broken it down pretty well now.

I want to have a MapView with a DrawerLayout with a transparent StatusBar and with a settings button with top margin in a framelayout over the map.

What happens is when i open the drawer, an area at the top, equal to the top button margin is not grayed out until after the drawer is completely opened.

I have an activity with the following layout:

<!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. -->
<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    >

    <FrameLayout
        android:id="@+id/layout_map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >

        <com.mapbox.mapboxgl.views.MapView
            android:id="@+id/map_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            />

        <!--
        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#00f"
            />
            -->

        <ImageButton
            android:id="@+id/view_hamburger"
            android:layout_gravity="start|top"
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:layout_marginTop="40dp"
            android:layout_marginStart="40dp"
            android:background="#f00"
            />

    </FrameLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/drawer_header"
        app:menu="@menu/drawer"
        />

</android.support.v4.widget.DrawerLayout>

And with the theme:

    <style name="MyStyle parent="@style/Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowTranslucentStatus">true</item>
    </style>

Activity

  1. hallahan commented on Jul 15, 2015

    @hallahan
    Contributor

    Hi @erf! My suspicion is that the GL canvas is not aligned right or interacts in a strange way with the transparent status bar. I am aware that Mapbox is working on a Material Design sample app that should encounter this issue.

    #1856

    Could you by any chance provide a screen shot of this problem on your phone?

  2. added
    Android
    on Jul 28, 2015
  3. ljbade commented on Jul 28, 2015

    @ljbade
    Contributor

    @bleege This may be related to the TextureView vs SurfaceView issue I mentioned this morning about animated layouts. Will be interesting is GLSurfaceView also has the same problem.

  4. modified the milestone: on Jul 28, 2015
  5. erf commented on Aug 6, 2015

    @erf
    ContributorAuthor

    screenshot_2015-08-06-16-43-40

  6. bleege commented on Aug 6, 2015

    @bleege
    Contributor

    Thanks for the screenshot and example @erf. Super helpful!

    We're going to be redoing the TestApp's UI to make it more compatible with Material Design / Navigation Drawers. We'll keep this in mind as it get's built out soon. The details on this and to follow along please see #1856.

  7. added this to the milestone on Aug 6, 2015
  8. ljbade commented on Sep 3, 2015

    @ljbade
    Contributor

    I have not seen this in our current TestApp which now uses a DrawerLayout.

    @erf Do you mind seeing if you can modify the TestApp UI to reproduce this and stick a branch with it up on GitHub?

  9. ljbade commented on Sep 3, 2015

    @ljbade
    Contributor

    Hmm did some testing with transparent status and navigation bars and I can't find any issue with MapView.

    It is posible this is a bug in Android or the support libs.

    @erf What happens when you replace:

    <com.mapbox.mapboxgl.views.MapView
                android:id="@+id/map_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                />
    

    with

    <View
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="#ff0000"
                />
    

    Do you get the same no shading while the drawer is opening?

  10. ljbade commented on Sep 4, 2015

    @ljbade
    Contributor

    We are pushing TextureView to 0.2.0 so we should wait to fix this bug then?

    @bleege ?

  11. modified the milestones: , android-v0.1.0 on Sep 4, 2015
  12. 1 remaining item

  13. ljbade commented on Sep 5, 2015

    @ljbade
    Contributor

    @bleege At this stage it is a hunch. Until @erf can provide us an example app that recreates this issue (I wasn't able to on my phone) there is no way to prove this bug is fixed.

    Also this bug appears to be related to the Android layout system so I'm thinking it might be a bug in the Android platform, or the layout has just not been set up correctly.

    I don't think it has much to do with MapView other than SurfaceView is a special case when it comes to Android layout as it directly draws to the screen instead of being composited like all other View. TextureView states it behaves just like a normal View.

  14. ljbade commented on Sep 5, 2015

    @ljbade
    Contributor

    @erf Do you mind recreating the bug against the TextureView implementation in https://github.com/mapbox/mapbox-gl-native/tree/2244-texture-view branch?

    I would like to know if this is a solution.

  15. tobrun commented on Sep 6, 2015

    @tobrun
    Member

    @ljbade I'm happy to report that I was able to get the correct behaviour using your branch 👍

    device-2015-09-06-093018
    device-2015-09-06-093027
    device-2015-09-06-093033

    Code in forked branch

  16. ljbade commented on Sep 7, 2015

    @ljbade
    Contributor

    @tobrun Excellent!

    Hopefully we can get this fix into 0.1.0

    /cc @bleege

  17. bleege commented on Sep 8, 2015

    @bleege
    Contributor

    Very cool. Thanks for running at this @ljbade @tobrun. Yep this is important so let's bolt #2244 into 0.1.0 ASAP. 👍

  18. modified the milestones: android-v0.1.0, on Sep 8, 2015
  19. modified the milestones: , android-v0.1.0 on Sep 8, 2015
  20. modified the milestones: android-v0.1.0, on Sep 9, 2015
  21. bleege commented on Sep 9, 2015

    @bleege
    Contributor

    Hooked up TextureView via #2244 and #2293 this afternoon.

    I'm going to close this issue for now as it looks like @tobrun @ljbade are confident that it fixes this issue. That said @erf please feel free to try the latest code out and reopen if you're still seeing issues.

    Great job everyone!

  22. erf commented on Sep 10, 2015

    @erf
    ContributorAuthor

    Sorry for the late reply, I can confirm that this is fixed using mapbox-gl-native commit 532bbd5
    Test repo her: https://github.com/erf/mapbox-drawer-glitch
    Great work!

  23. bleege commented on Sep 10, 2015

    @bleege
    Contributor

    Awesome! Thanks @erf!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Androidbug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions