6

スクロール中にGoogleマップv2で黒い背景を透明にする方法は?

<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>

マップ上に透明なフレームを付けましたが、それでもちらつきます。誰か私に解決策を教えてくださいありがとう

4

2 に答える 2

1

MapView 上の透明なフレームは、ブラック ホールの問題のみを解決します。ちらつきは、マップがそのリソースを再ロードするたびに、つまりOnCreateView()が呼び出されたときに発生します。

メインのアクティビティに MapView を追加し、初期化したら非表示にして、ここに投稿されたソリューションを試してください。

于 2013-03-12T16:02:10.037 に答える
0

この背後にある理由は、マップが SurfaceView を使用しているためです。アプリがこのビューを作成すると、アクティビティの背後にウィンドウが作成され、アクティビティのウィンドウ内のものが SurfaceView の元の場所の下に表示されないことを意味する穴が開けられます。

私にとって、これは魅力のように機能します。このライブラリを使用できます

https://github.com/NyxDigital/NiceSupportMapFragment/

これは私にとってはうまくいきます。

于 2015-06-20T10:39:12.183 に答える