3

I have a simple question. I was playing with the new android design supoort library and what i was trying to do is something similar that happens in google maps app when you select a marker or a point on the map: a sliding-up panel appears from the bottom. Like in these pictures

What I have created is an activity that extends AppCompatActivity and a layout structured in this way:

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">

<android.support.design.widget.CoordinatorLayout
    android:id="@+id/coordinatorLayout"
    android:layout_height="match_parent"
    android:layout_width="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:animateLayoutChanges="true">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|enterAlwaysCollapsed">
                   <fragment
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:id="@+id/map"
                        android:name="com.google.android.gms.maps.SupportMapFragment"
                        tools:context=".MapActivity"

                        map:cameraZoom="15"
                        map:mapType="normal"
                        map:uiCompass="true"
                        map:uiRotateGestures="true"
                        map:uiScrollGestures="true"
                        map:uiZoomControls="false"
                        map:uiZoomGestures="true"

                        app:layout_collapseMode="parallax"

                        android:animateLayoutChanges="true">
                   </fragment>

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="?attr/colorPrimary"
                app:layout_collapseMode="pin"/>

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/checkin" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/btnNWShowLocation"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_nw_pos"
        android:layout_gravity="bottom|start"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="@dimen/activity_vertical_margin"
        app:fabSize="normal"/>
    <android.support.design.widget.FloatingActionButton
        android:id="@+id/btnGPSShowLocation"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_gps_pos"
        app:layout_anchor="@+id/checkin_card"
        app:layout_anchorGravity="right"
        android:layout_marginBottom="@dimen/activity_vertical_margin"
        app:fabSize="normal"/>

</android.support.design.widget.CoordinatorLayout>

<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/navigation_drawer_header"
    android:backgroundTint="@color/my_divider"
    app:menu="@menu/menu_navigation_drawer" />

When I press on the btnGPSShowLocation FAB what I do is simply resize the map height to make enough space to show my checkin layout. But this is not smooth as it is in the google maps app.

Maybe this is not the right way to achieve what I want. Can you please help me?

neo87
  • 51
  • 2
  • 6
  • http://blog.neteril.org/blog/2013/10/10/framelayout-your-best-ui-friend/ – tyczj Jun 26 '15 at 19:25
  • [Design Support Library](http://android-developers.blogspot.com/2015/05/android-design-support-library.html) is great newest for android material design. I think you can refer [here](http://stackoverflow.com/q/31039074/4186942). – bjiang Jun 29 '15 at 18:19
  • Hi! Thank you both for your answers! I think the one that suits best for me is the one from @bjiang . But I tried to add "setOverlayTop" programmatically using the code in the other answer, but nothing happens! Can you help me? – neo87 Jul 02 '15 at 20:51

0 Answers0