滚动型内给片段黑色背景闪烁 [英] Fragment inside ScrollView gives black background flickering

查看:170
本文介绍了滚动型内给片段黑色背景闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在活动为主要布局之一的LinearLayout。我用滚动型包封的LinearLayout中。布局包含显示谷歌地图片段,但滚动它给了黑色背景。我用的FrameLayout里面的透明背景解决了问题。黑色背景已经走了,但滚动的过程中出现了闪烁在地图各处的黑边。如何去除呢?我试着设置滚动型的,以白色为背景,但没有任何变化可见。

该活动的XML是 -

 <?XML版本=1.0编码=UTF-8&GT?;
<滚动型
的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:ID =@ + ID /滚动
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:背景=#FFFFFF
>
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:背景=#FFFFFF
机器人:baselineAligned =假
机器人:方向=垂直
机器人:overScrollMode =ifContentScrolls
机器人:scrollbarStyle =insideOverlay
机器人:滚动条=垂直
机器人:showDividers =无>< RelativeLayout的
    机器人:layout_width =match_parent
    机器人:layout_height =45dp
    机器人:背景=#ec4d1d>    <的TextView
        机器人:ID =@ + ID / FRIEND_NAME
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_centerVertical =真
        机器人:layout_marginLeft =7DP
        机器人:背景=@绘制/ near_you_bg
        机器人:重力=CENTER_HORIZONTAL | center_vertical
        机器人:填充=6DP        机器人:文字颜色=#FFFFFF
        机器人:TEXTSIZE =15sp
        机器人:文字样式=大胆
        机器人:字体=SANS/>    <按钮
        机器人:ID =@ + ID / btnInviteFriends
        机器人:layout_width =30dp
        机器人:layout_height =25dp
        机器人:layout_alignParentRight =真
        机器人:layout_centerVertical =真
        机器人:layout_marginRight =7DP
        机器人:背景=@绘制/ menu_bg
        安卓的onClick =inviteFriends/>< / RelativeLayout的>< RelativeLayout的
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =81dp
    机器人:背景=@绘制/ list_bg
    机器人:方向=垂直>    < TableLayout
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        机器人:layout_centerHorizo​​ntal =真
        机器人:layout_centerVertical =真
        机器人:shrinkColumns =*
        机器人:stretchColumns =*>        <的TableRow
            机器人:layout_width =match_parent
            机器人:layout_height =match_parent
            机器人:layout_gravity =center_vertical | CENTER_HORIZONTAL
            机器人:layout_marginTop =4DP
            机器人:重力=center_vertical | CENTER_HORIZONTAL>            < RelativeLayout的
                机器人:layout_width =65dp
                机器人:layout_height =70dp>                < ImageView的
                    机器人:ID =@ + ID / user_image
                    机器人:layout_width =match_parent
                    机器人:layout_height =match_parent
                    机器人:layout_alignWithParentIfMissing =假
                    机器人:layout_centerHorizo​​ntal =真
                    机器人:layout_centerVertical =真
                    机器人:layout_marginTop =7DP
                    机器人:SRC =@绘制/ d_bg/>            < / RelativeLayout的>            < RelativeLayout的
                机器人:layout_width =140dp
                机器人:layout_height =70dp>                <的TextView
                    机器人:ID =@ + ID /名称
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_marginTop =0dp
                    机器人:layout_toRightOf =@ ID / user_image
                    机器人:paddingBottom会=2DIP
                    机器人:文字=Amrinder
                    机器人:文字颜色=#000000
                    机器人:TEXTSIZE =16SP
                    机器人:文字样式=大胆/>                <的TextView
                    机器人:ID =@ + ID /距离
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_below =@ ID /名称
                    机器人:layout_marginTop =2DP
                    机器人:layout_toRightOf =@ ID / user_image
                    机器人:文字=说明
                    机器人:文字颜色=#000000
                    机器人:TEXTSIZE =10SP>                < / TextView的>                <的LinearLayout
                    机器人:layout_width =FILL_PARENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_below =@ ID /距离
                    机器人:layout_marginTop =7DP
                    机器人:方向=横向>                    < ImageView的
                        机器人:ID =@ + ID / common_icon
                        机器人:layout_width =26dp
                        机器人:layout_height =19dp
                        机器人:背景=@绘制/ common_icon/>                    <的TextView
                        机器人:ID =@ + ID / common_number
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:layout_marginLeft =3DP
                        机器人:文字=4
                        机器人:文字颜色=#000000
                        机器人:文字样式=大胆/>                    < ImageView的
                        机器人:ID =@ + ID / friends_icon
                        机器人:layout_width =26dp
                        机器人:layout_height =19dp
                        机器人:layout_marginLeft =7DP
                        机器人:背景=@绘制/ friends_icon/>                    <的TextView
                        机器人:ID =@ + ID / friends_number
                        机器人:layout_width =WRAP_CONTENT
                        机器人:layout_height =WRAP_CONTENT
                        机器人:layout_marginLeft =3DP
                        机器人:文字=5
                        机器人:文字颜色=#000000
                        机器人:文字样式=大胆/>
                < / LinearLayout中>                <的TextView
                    机器人:ID =@ + ID / nearUserInfo
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:知名度=隐形>
                < / TextView的>
            < / RelativeLayout的>            < RelativeLayout的
                机器人:layout_width =match_parent
                机器人:layout_height =match_parent>                <的TextView
                    机器人:ID =@ + ID / TIME_AGO
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT                    机器人:文字=10分钟前
                    />                < ImageView的
                    机器人:ID =@ + ID / dir_img
                    机器人:layout_width =WRAP_CONTENT
                    机器人:layout_height =WRAP_CONTENT
                    机器人:layout_below =@ ID / TIME_AGO
                    机器人:layout_centerHorizo​​ntal =真
                    机器人:layout_marginTop =23dp
                    机器人:背景=@绘制/ say_hi_button/>            < / RelativeLayout的>
        < /&的TableRow GT;
    < / TableLayout>
< / RelativeLayout的>< RelativeLayout的
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_margin =5DP
>< ImageView的
    机器人:ID =@ + ID / map_bar
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =25dip
    机器人:layout_centerInParent =假
    机器人:layout_gravity =CENTER_HORIZONTAL
    机器人:背景=@绘制/ map_box_bg/>
< RelativeLayout的
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =25dp>    <的TextView
        机器人:ID =@ + ID / distance_text
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_centerVertical =真
        机器人:layout_marginLeft =1DP
        机器人:文字=X 4公里的你现在东北
        机器人:文字颜色=#FFFFFF
        机器人:文字样式=大胆/>< / RelativeLayout的>
<的FrameLayout
    机器人:ID =@ + ID / frame_layout
    机器人:layout_width =match_parent
    机器人:layout_height =match_parent>
<片段
    机器人:ID =@ + ID /图
    机器人:名字=com.google.android.gms.maps.MapFragment
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =150dp
    机器人:layout_below =@ ID / map_bar    />
<查看
        机器人:ID =@ + ID / trans_img
        机器人:layout_width =match_parent
        机器人:layout_height =match_parent
        机器人:SRC =@绘制/反/>
< /&的FrameLayout GT;< / RelativeLayout的>< RelativeLayout的
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_margin =5DP>< ImageView的
    机器人:ID =@ + ID / like_bar
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =25dip
    机器人:layout_gravity =CENTER_HORIZONTAL
    机器人:背景=@绘制/ map_box_bg/>    < RelativeLayout的
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =25dp>    < ImageView的
        机器人:ID =@ + ID / like_button
        机器人:layout_width =24dp
        机器人:layout_height =23dp        机器人:layout_centerVertical =真
        机器人:layout_marginLeft =1DP
        机器人:背景=@绘制/ common_detail_icon/>    <的TextView
        机器人:ID =@ + ID / likes_in_common
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =FILL_PARENT
        机器人:layout_toRightOf =@ ID / like_button
        机器人:重力=center_vertical
        机器人:文字=3喜欢在常见的
        机器人:文字颜色=#FFFFFF
        机器人:文字样式=大胆/>    < / RelativeLayout的>< ImageView的
    机器人:ID =@ + ID / like_bg
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_below =@ ID / like_bar
    机器人:layout_gravity =CENTER_HORIZONTAL
    机器人:背景=@绘制/ list_bg/>< / RelativeLayout的>< RelativeLayout的
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_margin =5DP>< ImageView的
    机器人:ID =@ + ID / friends_bar
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =25dip
    机器人:layout_gravity =CENTER_HORIZONTAL
    机器人:背景=@绘制/ map_box_bg/>    < RelativeLayout的
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =25dp
    机器人:layout_alignParentRight =真正的>    < ImageView的
        机器人:ID =@ + ID / friends_button
        机器人:layout_width =24dp
        机器人:layout_height =23dp        机器人:layout_centerVertical =真
        机器人:layout_marginLeft =1DP
        机器人:背景=@绘制/ common_friends_icon/>    <的TextView
        机器人:ID =@ + ID / friends_in_common
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =FILL_PARENT
        机器人:layout_toRightOf =@ ID / friends_button
        机器人:重力=center_vertical
        机器人:文字=9共同的朋友
        机器人:文字颜色=#FFFFFF
        机器人:文字样式=大胆/>    < / RelativeLayout的>< ImageView的
    机器人:ID =@ + ID / friends_bg
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_below =@ ID / friends_bar
    机器人:layout_gravity =CENTER_HORIZONTAL
    机器人:背景=@绘制/ list_bg/>< / RelativeLayout的>
< RelativeLayout的
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_margin =5DP>< ImageView的
    机器人:ID =@ + ID / friends_bar
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =25dip
    机器人:layout_gravity =CENTER_HORIZONTAL
    机器人:背景=@绘制/ map_box_bg/>    < RelativeLayout的
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =25dp
    机器人:layout_alignParentRight =真正的>    < ImageView的
        机器人:ID =@ + ID / friends_button
        机器人:layout_width =24dp
        机器人:layout_height =23dp        机器人:layout_centerVertical =真
        机器人:layout_marginLeft =1DP
        机器人:背景=@绘制/ common_friends_icon/>    <的TextView
        机器人:ID =@ + ID / friends_in_common
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =FILL_PARENT
        机器人:layout_toRightOf =@ ID / friends_button
        机器人:重力=center_vertical
        机器人:文字=9共同的朋友
        机器人:文字颜色=#FFFFFF
        机器人:文字样式=大胆/>    < / RelativeLayout的>< ImageView的
    机器人:ID =@ + ID / friends_bg
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_below =@ ID / friends_bar
    机器人:layout_gravity =CENTER_HORIZONTAL
    机器人:背景=@绘制/ list_bg/>< / RelativeLayout的>< RelativeLayout的
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_margin =5DP>< ImageView的
    机器人:ID =@ + ID / friends_bar
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =25dip
    机器人:layout_gravity =CENTER_HORIZONTAL
    机器人:背景=@绘制/ map_box_bg/>    < RelativeLayout的
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =25dp
    机器人:layout_alignParentRight =真正的>    < ImageView的
        机器人:ID =@ + ID / friends_button
        机器人:layout_width =24dp
        机器人:layout_height =23dp        机器人:layout_centerVertical =真
        机器人:layout_marginLeft =1DP
        机器人:背景=@绘制/ common_friends_icon/>    <的TextView
        机器人:ID =@ + ID / friends_in_common
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =FILL_PARENT
        机器人:layout_toRightOf =@ ID / friends_button
        机器人:重力=center_vertical
        机器人:文字=9共同的朋友
        机器人:文字颜色=#FFFFFF
        机器人:文字样式=大胆/>    < / RelativeLayout的>< ImageView的
    机器人:ID =@ + ID / friends_bg
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:layout_below =@ ID / friends_bar
    机器人:layout_gravity =CENTER_HORIZONTAL
    机器人:背景=@绘制/ list_bg/>
< / RelativeLayout的>
< / LinearLayout中>
< /滚动型>


解决方案
如果不使用,你试试用透明色becauz我也面临着同样的问题,我用这个方法解决了地图片段上方的透明图像的

 的android:背景=@机器人:彩色/透明

不过,从技术上来说通过Android作为建议,你不应该使用滚动元件另一滚动element.Rather里面你可以使用谷歌地图静态地图API来显示滚动视图内静态地图,当你在滚动挖掘查看您可以打开滚动谷歌地图在新窗口中。

I have a LinearLayout in one of the activities as the main layout. I used Scrollview to encapsulated the LinearLayout. The Layout contains a fragment which displays a google map, but on scrolling it gave black background. I resolved the issue by using a transparent background inside a FrameLayout. The black background has gone, but during scrolling i get flickering black edges around the map. How to remove this? I tried setting the background of Scrollview to white color, but no change visible.

The XML of the activity is --

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

解决方案

Instead of using a transparent image above the map fragment you try using the transparent color becauz i was also facing the same issue and i solved using this method.

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

But technically speaking as suggested by Android you should not use a scrolling element inside another scrolling element.Rather you can use the Google map static map API to show static map inside scroll view and when you tap on scroll view you can open a Scrollable google map in a new window.

这篇关于滚动型内给片段黑色背景闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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