Android的谷歌地图V2片段黑色BG问题 [英] android google map v2 fragment black bg issue

查看:173
本文介绍了Android的谷歌地图V2片段黑色BG问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使黑色背景透明的谷歌地图V2滚动时?

How to make the black background transparent in google map v2 while scrolling?

<RelativeLayout
                    android:id="@+id/relativeLayout1"
                    android:layout_width="match_parent"
                    android:layout_height="134dp"
                    android:layout_alignParentTop="true"
                    android:layout_gravity="center" >

                    <fragment
                        xmlns:android="http://schemas.android.com/apk/res/android"
                        android:id="@+id/map"
                        android:layout_width="fill_parent"
                        android:layout_height="434dp"
                        android:layout_marginBottom="-150dp"
                        android:layout_marginLeft="3dp"
                        android:layout_marginRight="3dp"
                        android:layout_marginTop="-150dp"                       
                        class="com.google.android.gms.maps.SupportMapFragment"
                        android:cacheColorHint="@color/transparent"
                        android:clickable="true" />

                    <FrameLayout
                        android:id="@+id/fram_lay"
                        android:layout_width="match_parent"
                        android:layout_height="172dp" >

                        <android.support.v4.view.ViewPager
                            android:id="@+id/fragment_container"
                            android:layout_width="fill_parent"
                            android:layout_height="134dp" >
                        </android.support.v4.view.ViewPager>

                        <FrameLayout
                            android:id="@+id/fram_lay2"
                            android:layout_width="match_parent"
                            android:layout_height="334dp"
                            android:layout_marginTop="-100dp"                            
                            android:background="@android:color/transparent"
                            android:cacheColorHint="#00000000" />
                    </FrameLayout>
                </RelativeLayout>

我已经给了透明边框在地图上,但仍然在闪烁。 请有人给我一个解决方案 谢谢

I have given transparent frame over map but still it is flickering. please somebody give me a solution thank you

推荐答案

透明框上的MapView将不仅解决了黑洞问题,闪烁依然每次在地图重新载入它的资源,即发生在 OnCreateView()之称。

The transparent frame over the MapView will only solve the black hole problem, the flicker will still happen each time the map re-loads it's resources i.e. when OnCreateView() is called.

尝试解决方案发布<一个href="http://stackoverflow.com/questions/14419521/moving-mapfragment-surfaceview-causes-black-background-flickering">here与添加一个图形页面的主要活动,然后躲在一次初始化。

Try the solution posted here with adding a MapView in the main Activity and then hiding it once initialized.

这篇关于Android的谷歌地图V2片段黑色BG问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆