0

I have imported my eclipse project to Android Studio and updated to com.google.android.gms.common.api.GoogleApiClient.

My Project has one main activity with many fragments. Home button fragment has Map in it. See below for adding map:

    private void addMap() {
FragmentManager fm = getChildFragmentManager();
if(isGoogleMapsInstalled())
    {
        if (fragment == null) 
        {
            GoogleMapOptions op = new GoogleMapOptions();
            op.zOrderOnTop(true);
            op.zoomControlsEnabled(false);
            fragment = MapFragment.newInstance(op);
            fm.beginTransaction().replace(R.id.homemap_id, fragment).commit();
        }
    }else
    {
        Toast.makeText(getActivity(), "Please install google map", Toast.LENGTH_SHORT).show();
    }
}

On running project successfully, the map hiding all views and buttons placed on it. Even the MainActivity's Menu Slider shows below map but works from over map and map becomes disable.

enter image description here

** Edit :: Thought it could be becoz of some memory issue so used below code in app gradle, but no luck.

    multiDexEnabled true
dexOptions {
incremental true
javaMaxHeapSize "4g"

}

Please help to resolve this issue. ** Note :: the code worked well in Eclipse.

edit ::

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/bg_texture_a"
    android:orientation="vertical" >

    <RelativeLayout android:id="@+id/map_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1" >

        <FrameLayout
            android:id="@+id/homemap_id"
            android:background="@color/dark_red_text_trans"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
        </FrameLayout>

        <CheckBox
            android:id="@+id/traffic_heat_btn"
            android:layout_width="42dp"
            android:layout_height="42dp"
            android:layout_alignParentRight="true"
            android:layout_marginRight="10dp"
            android:layout_marginTop="70dp"
            android:background="@drawable/selector_traffic_toggle"
            android:button="@null"
            android:checked="false"
            android:scaleType="fitCenter" />

        <TextView
            android:id="@+id/mylocation_btn"
            android:layout_width="42dp"
            android:layout_height="42dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentBottom="true"
            android:layout_marginRight="10dp"
            android:layout_marginBottom="70dp"
            android:background="@drawable/selector_location_toggle"
            android:button="@null"
            android:scaleType="fitCenter" />

       <HorizontalScrollView
            android:id="@+id/box_horizonScroll"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="0dp"
            android:orientation="horizontal"
            android:scrollbars="vertical"
            android:visibility="gone" >

            <!-- android:background="#aaffffff" -->

            <LinearLayout
                android:id="@+id/dependent_layout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:paddingLeft="5dp"
                android:paddingRight="5dp" >
            </LinearLayout>

        </HorizontalScrollView>


    </RelativeLayout>

    <LinearLayout
        android:id="@+id/mask_bottom_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:background="@color/dark_red_text"
        android:gravity="center_vertical"
        android:orientation="horizontal"
        android:visibility="gone" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0"
            android:paddingBottom="17dp"
            android:paddingLeft="20dp"
            android:paddingTop="17dp"
            android:text="Cancel"
            android:textColor="@color/white"
            android:textSize="@dimen/text_sizes_smallest"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center"
            android:text="DONE"
            android:textColor="@color/white"
            android:textSize="@dimen/text_sizes_medium"
            android:textStyle="bold" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="0"
            android:paddingRight="15dp"
            android:text="Clear Filters"
            android:textColor="@color/white"
            android:textSize="@dimen/text_sizes_smallest"
            android:textStyle="bold"
            android:visibility="visible" />
    </LinearLayout>

</LinearLayout>
Deepak
  • 33
  • 6

1 Answers1

1

find out Here solution for you problem. I have got the same problem here on ICS 4.0.4. The solutions mentioned in jfeinstein10's github post seems not working for me. But I have found a workaround, even it is not the best.

When creating DrawerToggle object I override this event

@Override
public void onDrawerSlide(View drawerView, float slideOffset)
{
     super.onDrawerSlide(drawerView, slideOffset);
     mDrawerLayout.bringChildToFront(drawerView);
     mDrawerLayout.requestLayout();
     mDrawerLayout.setScrimColor(Color.TRANSPARENT);

}

bringChildToFront and requestLayout method should overcome the drawer rendering problem while setScrimColor will get rid of the shadow. Too bad that I haven't found a workaround to render the shadow correctly as well. Hope this helps.

Community
  • 1
  • 1
AndroidLad
  • 687
  • 7
  • 14