Question

i'm trying to build an android app which uses google maps with the support fragment libraries, everything was going fine until i tried to implement my own sliding menu, which didn't seem like a big task, i just put it behind the main activity fragment, and when i want to show it i slide the main screen to the right. sounds simple enough right? well it was all working fine except for one thing, whenever i tried to apply translation (may it be in animation or without) the layout would start flickering non stop, i have no idea why this happens, i tried to do it in several ways but the main issue remained, whenever i use translation, the layout would flicker and other layouts too.

another thing to note is that i have Samsung Galaxy S2, i tried to run the app on my friends HTC and it worked fine, plz help! heres a video: http://www.youtube.com/watch?v=ICpu5s5r7xE

Was it helpful?

Solution

i solved this by adding a transparent imageView on top of my map, i guess it forced a different kind of redraw to the screen, this idea wasn't mine, i got it from a different google maps related problem, this is how my xml looks now (part of it)

    <fragment
        android:layout_marginLeft="-40dp"
        android:layout_marginRight="-40dp"
        android:id="@+id/map_fragment"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        class="com.google.android.gms.maps.SupportMapFragment" />

    <ImageView 
        android:id="@+id/map_overlay"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/transparent"
        />

hope this helps! :)

OTHER TIPS

I had a similar problem like that a while ago (it was flickering just while moving). Try writing this code in the manifest for your fragment activity:

android:hardwareAccelerated="false"

because of android version differences, this flickering is happening. If your activity is not so intense you can solve like this. But if it becomes too slow, either you will declare version check and apply this programmatically for different apis, or finding another solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top