6

メインレイアウトとしてアクティビティの1つにLinearLayoutがあります。私はScrollviewを使ってLinearLayoutをカプセル化しました。レイアウトにはGoogleマップを表示するフラグメントが含まれていますが、スクロールすると黒い背景が表示されます。 FrameLayoutの透明な背景を使用して問題を解決しました。黒い背景は消えましたが、スクロール中に地図上で黒い辺が点滅します。これを削除するには? Scrollviewの背景を白色に設定しようとしましたが、変更は見えません。ScrollView内のフラグメントで黒い背景がちらつきます

活動のXMLです - 代わりにあなたは私も同じ問題に直面していたし、私はこの方法を使用して解決becauz透明色を使用してみてくださいマップフラグメントの上に透明の画像を使用しての

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/scroll" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="#FFFFFF" 
> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:background="#FFFFFF" 
android:baselineAligned="false" 
android:orientation="vertical" 
android:overScrollMode="ifContentScrolls" 
android:scrollbarStyle="insideOverlay" 
android:scrollbars="vertical" 
android:showDividers="none" > 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="45dp" 
    android:background="#ec4d1d" > 

    <TextView 
     android:id="@+id/friend_name" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerVertical="true" 
     android:layout_marginLeft="7dp" 
     android:background="@drawable/near_you_bg" 
     android:gravity="center_horizontal|center_vertical" 
     android:padding="6dp" 

     android:textColor="#FFFFFF" 
     android:textSize="15sp" 
     android:textStyle="bold" 
     android:typeface="sans" /> 

    <Button 
     android:id="@+id/btnInviteFriends" 
     android:layout_width="30dp" 
     android:layout_height="25dp" 
     android:layout_alignParentRight="true" 
     android:layout_centerVertical="true" 
     android:layout_marginRight="7dp" 
     android:background="@drawable/menu_bg" 
     android:onClick="inviteFriends" /> 

</RelativeLayout> 

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="81dp" 
    android:background="@drawable/list_bg" 
    android:orientation="vertical" > 

    <TableLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:shrinkColumns="*" 
     android:stretchColumns="*" > 

     <TableRow 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_gravity="center_vertical|center_horizontal" 
      android:layout_marginTop="4dp" 
      android:gravity="center_vertical|center_horizontal" > 

      <RelativeLayout 
       android:layout_width="65dp" 
       android:layout_height="70dp" > 

       <ImageView 
        android:id="@+id/user_image" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_alignWithParentIfMissing="false" 
        android:layout_centerHorizontal="true" 
        android:layout_centerVertical="true" 
        android:layout_marginTop="7dp" 
        android:src="@drawable/d_bg" /> 

      </RelativeLayout> 

      <RelativeLayout 
       android:layout_width="140dp" 
       android:layout_height="70dp" > 

       <TextView 
        android:id="@+id/name" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="0dp" 
        android:layout_toRightOf="@id/user_image" 
        android:paddingBottom="2dip" 
        android:text="Amrinder" 
        android:textColor="#000000" 
        android:textSize="16sp" 
        android:textStyle="bold" /> 

       <TextView 
        android:id="@+id/distance" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@id/name" 
        android:layout_marginTop="2dp" 
        android:layout_toRightOf="@id/user_image" 
        android:text="description" 
        android:textColor="#000000" 
        android:textSize="10sp" > 

       </TextView> 

       <LinearLayout 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@id/distance" 
        android:layout_marginTop="7dp" 
        android:orientation="horizontal" > 

        <ImageView 
         android:id="@+id/common_icon" 
         android:layout_width="26dp" 
         android:layout_height="19dp" 
         android:background="@drawable/common_icon" /> 

        <TextView 
         android:id="@+id/common_number" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_marginLeft="3dp" 
         android:text="4" 
         android:textColor="#000000" 
         android:textStyle="bold" /> 

        <ImageView 
         android:id="@+id/friends_icon" 
         android:layout_width="26dp" 
         android:layout_height="19dp" 
         android:layout_marginLeft="7dp" 
         android:background="@drawable/friends_icon" /> 

        <TextView 
         android:id="@+id/friends_number" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_marginLeft="3dp" 
         android:text="5" 
         android:textColor="#000000" 
         android:textStyle="bold" /> 
       </LinearLayout> 

       <TextView 
        android:id="@+id/nearUserInfo" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:visibility="invisible" > 
       </TextView> 
      </RelativeLayout> 

      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" > 

       <TextView 
        android:id="@+id/time_ago" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 

        android:text="10 min ago" 
        /> 

       <ImageView 
        android:id="@+id/dir_img" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_below="@id/time_ago" 
        android:layout_centerHorizontal="true" 
        android:layout_marginTop="23dp" 
        android:background="@drawable/say_hi_button" /> 

      </RelativeLayout> 
     </TableRow> 
    </TableLayout> 
</RelativeLayout> 

<RelativeLayout 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:layout_margin="5dp" 
> 

<ImageView 
    android:id="@+id/map_bar" 
    android:layout_width="fill_parent" 
    android:layout_height="25dip" 
    android:layout_centerInParent="false" 
    android:layout_gravity="center_horizontal" 
    android:background="@drawable/map_box_bg" /> 


<RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="25dp" > 

    <TextView 
     android:id="@+id/distance_text" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerVertical="true" 
     android:layout_marginLeft="1dp" 
     android:text="X is 4 km north-east of you now" 
     android:textColor="#ffffff" 
     android:textStyle="bold" /> 

</RelativeLayout> 
<FrameLayout 
    android:id="@+id/frame_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 
<fragment 
    android:id="@+id/map" 
    android:name="com.google.android.gms.maps.MapFragment" 
    android:layout_width="fill_parent" 
    android:layout_height="150dp" 
    android:layout_below="@id/map_bar" 

    /> 
<View 
     android:id="@+id/trans_img" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:src="@drawable/trans" />   
</FrameLayout> 

</RelativeLayout> 

<RelativeLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_margin="5dp" > 

<ImageView 
    android:id="@+id/like_bar" 
    android:layout_width="fill_parent" 
    android:layout_height="25dip" 
    android:layout_gravity="center_horizontal" 
    android:background="@drawable/map_box_bg" /> 

    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="25dp" > 

    <ImageView 
     android:id="@+id/like_button" 
     android:layout_width="24dp" 
     android:layout_height="23dp" 

     android:layout_centerVertical="true" 
     android:layout_marginLeft="1dp" 
     android:background="@drawable/common_detail_icon" /> 

    <TextView 
     android:id="@+id/likes_in_common" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_toRightOf="@id/like_button" 
     android:gravity="center_vertical" 
     android:text=" 3 likes in common" 
     android:textColor="#FFFFFF" 
     android:textStyle="bold" /> 

    </RelativeLayout> 

<ImageView 
    android:id="@+id/like_bg" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/like_bar" 
    android:layout_gravity="center_horizontal" 
    android:background="@drawable/list_bg" /> 

</RelativeLayout> 

<RelativeLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_margin="5dp" > 

<ImageView 
    android:id="@+id/friends_bar" 
    android:layout_width="fill_parent" 
    android:layout_height="25dip" 
    android:layout_gravity="center_horizontal" 
    android:background="@drawable/map_box_bg" /> 

    <RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="25dp" 
    android:layout_alignParentRight="true" > 

    <ImageView 
     android:id="@+id/friends_button" 
     android:layout_width="24dp" 
     android:layout_height="23dp" 

     android:layout_centerVertical="true" 
     android:layout_marginLeft="1dp" 
     android:background="@drawable/common_friends_icon" /> 

    <TextView 
     android:id="@+id/friends_in_common" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_toRightOf="@id/friends_button" 
     android:gravity="center_vertical" 
     android:text=" 9 friends in common" 
     android:textColor="#FFFFFF" 
     android:textStyle="bold" /> 

    </RelativeLayout> 

<ImageView 
    android:id="@+id/friends_bg" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/friends_bar" 
    android:layout_gravity="center_horizontal" 
    android:background="@drawable/list_bg" /> 



</RelativeLayout> 


<RelativeLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_margin="5dp" > 

<ImageView 
    android:id="@+id/friends_bar" 
    android:layout_width="fill_parent" 
    android:layout_height="25dip" 
    android:layout_gravity="center_horizontal" 
    android:background="@drawable/map_box_bg" /> 

    <RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="25dp" 
    android:layout_alignParentRight="true" > 

    <ImageView 
     android:id="@+id/friends_button" 
     android:layout_width="24dp" 
     android:layout_height="23dp" 

     android:layout_centerVertical="true" 
     android:layout_marginLeft="1dp" 
     android:background="@drawable/common_friends_icon" /> 

    <TextView 
     android:id="@+id/friends_in_common" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_toRightOf="@id/friends_button" 
     android:gravity="center_vertical" 
     android:text=" 9 friends in common" 
     android:textColor="#FFFFFF" 
     android:textStyle="bold" /> 

    </RelativeLayout> 

<ImageView 
    android:id="@+id/friends_bg" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/friends_bar" 
    android:layout_gravity="center_horizontal" 
    android:background="@drawable/list_bg" /> 



</RelativeLayout> 



<RelativeLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:layout_margin="5dp" > 

<ImageView 
    android:id="@+id/friends_bar" 
    android:layout_width="fill_parent" 
    android:layout_height="25dip" 
    android:layout_gravity="center_horizontal" 
    android:background="@drawable/map_box_bg" /> 

    <RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="25dp" 
    android:layout_alignParentRight="true" > 

    <ImageView 
     android:id="@+id/friends_button" 
     android:layout_width="24dp" 
     android:layout_height="23dp" 

     android:layout_centerVertical="true" 
     android:layout_marginLeft="1dp" 
     android:background="@drawable/common_friends_icon" /> 

    <TextView 
     android:id="@+id/friends_in_common" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_toRightOf="@id/friends_button" 
     android:gravity="center_vertical" 
     android:text=" 9 friends in common" 
     android:textColor="#FFFFFF" 
     android:textStyle="bold" /> 

    </RelativeLayout> 

<ImageView 
    android:id="@+id/friends_bg" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/friends_bar" 
    android:layout_gravity="center_horizontal" 
    android:background="@drawable/list_bg" /> 
</RelativeLayout> 
</LinearLayout> 
</ScrollView> 

答えて

4

android:background="@android:color/transparent" 

しかし、技術的にあなたがスクロールビュー内の静的な地図を表示するには、GoogleマップのスタティックマップのAPIを使用することができますし、スクロールビューをタップしたときに別のスクロールelement.Rather内のスクロール要素を使うべきではありませんアンドロイドによって示唆されているように話しますスクロール可能なGoogleマップを新しいウィンドウで開くことができます。

+0

素敵な提案@karan_ranaこのライブラリを使用することができます! :) –

+1

私はなぜそれが好きですか、私はいくつかのソリューションを使用して、スクロールビューとこれを拡張して、なぜですか?それはGoogleの混乱のようなものですか? – JRowan

0

MapはSurfaceViewを使用しています。このビューを作成すると、アクティビティの後ろにWindowが作​​成され、ActivityViewの元の位置の下にアクティビティのウィンドウ内のものが見えないという穴がパンチされます。私にとって

が、これは魅力のように働いている私は、他の方法ラウンドをそれを考え出したのに、あなたは、

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

関連する問題