First of all, I know the SlidingDrawer is deprecated, but I haven't found any alternative to it so I'm using it anyways :3 (If someone knows an alternative to it, please share it!)
So I have a GoogleMap in my activity (actually a fragment but it doesn't matter), and a nice SlidingDrawer in the same screen. It works fine, but when I open or close the slidingdrawer over the map, it starts behaving weird. It looks like the map want's to stay in front of the slidingdrawer. When the drawer is fully opened, then it comes back to the front and everything is ok.
Is there a workaround for this? I am getting crazy!
here is my layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/window"
>
<fragment
android:id="@+id/hackedmap"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.SupportMapFragment" />
<SlidingDrawer
android:id="@+id/drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:content="@+id/drawercontent"
android:handle="@+id/drawerhandle"
android:orientation="horizontal"
>
<LinearLayout
android:id="@id/drawerhandle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
android:gravity="center" >
<ImageView
android:id="@+id/slidingHandle"
android:layout_width="40dp"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitEnd"
android:src="@drawable/sliding_handle" />
</LinearLayout>
<LinearLayout
android:id="@+id/drawercontent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#DD000000"
android:gravity="center_horizontal|top"
android:orientation="vertical" >
<TextView
android:id="@+id/selectednet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="4dp"
android:text="Select a network:"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#02bceb" />
<ListView
android:id="@+id/passivelist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:choiceMode="singleChoice" >
</ListView>
</LinearLayout>
</SlidingDrawer>
</RelativeLayout>
Put the map inside of a relative layout. In front of the map a view with the same measure.
Example:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<include
android:layout_width="wrap_content"
android:layout_height="250dp"
android:layout_weight="1"
layout="@layout/general_map_fragment" />
<View
android:id="@+id/imageView123"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="@color/transparent" />
</RelativeLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With