Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 丑陋片段过渡到带覆盖的surfaceview_Android_Overlay_Fragment_Surfaceview_Transition - Fatal编程技术网

Android 丑陋片段过渡到带覆盖的surfaceview

Android 丑陋片段过渡到带覆盖的surfaceview,android,overlay,fragment,surfaceview,transition,Android,Overlay,Fragment,Surfaceview,Transition,我的应用程序其中一个片段在曲面视图中绘制了一张地图,上面覆盖着按钮和文本 其他大部分片段都是列表。我的问题是,在地图和另一个片段之间的转换过程中,丑陋的黑色矩形瞬间出现在地图视图中,其中放置了文本和按钮视图。这在返回到贴图的过渡上更为明显,尽管它确实在两个方向上发生。我使用的是幻灯片左/右动画,它在所有其他方面都很好地工作。我尝试过其他动画,但没有动画。在转换之前将文本和按钮设置为不可见也无济于事,因为视图仍在覆盖中 如果有人对如何实现干净的片段转换有任何想法,我们将不胜感激。我正在使用支持片段

我的应用程序其中一个片段在曲面视图中绘制了一张地图,上面覆盖着按钮和文本

其他大部分片段都是列表。我的问题是,在地图和另一个片段之间的转换过程中,丑陋的黑色矩形瞬间出现在地图视图中,其中放置了文本和按钮视图。这在返回到贴图的过渡上更为明显,尽管它确实在两个方向上发生。我使用的是幻灯片左/右动画,它在所有其他方面都很好地工作。我尝试过其他动画,但没有动画。在转换之前将文本和按钮设置为不可见也无济于事,因为视图仍在覆盖中

如果有人对如何实现干净的片段转换有任何想法,我们将不胜感激。我正在使用支持片段管理器

这是我的代码(这里的文本和按钮比下面显示的要多得多):

布局xml文件:

<?xml version="1.0" encoding="utf-8"?>


<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapframeview"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
 >


<com.mypackage.MapView 
    android:id="@+id/maptileview"  
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
</com.mypackage.MapView>

<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapoverlay"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" >

   <TextView
    android:id="@+id/titletext"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentTop="true"
    android:paddingTop="10dp"
    android:textColor="#FFFFFF"
    android:textSize="24dp"
    android:textStyle="bold" />

    <ImageButton
    android:id="@+id/bookButton"
    android:onClick="onClickBookButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentRight="true"
    android:paddingTop="15dp"
    android:paddingRight="15dp"
    android:background="@android:color/transparent"
    android:src="@drawable/bookbutton">
    </ImageButton>

  </RelativeLayout>

 </FrameLayout>        
动画XML:

<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/anim/slide_in_right.xml */
-->

<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="50%p" android:toXDelta="0"
        android:duration="@android:integer/config_mediumAnimTime"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
        android:duration="@android:integer/config_mediumAnimTime" />
</set>

<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/res/anim/slide_out_left.xml*/
-->

<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="0" android:toXDelta="-50%p"
        android:duration="@android:integer/config_mediumAnimTime"/>
<alpha android:fromAlpha="1.0" android:toAlpha="0.0"
        android:duration="@android:integer/config_mediumAnimTime" />
</set>

如果使用SurfaceView,请使背景透明

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

这对我有效,闪烁消失了。

可能重复感谢-这可能是一个相关的问题,但我不认为这是重复的,因为问题与覆盖有关。没有覆盖层,过渡是干净的。我们没有使用谷歌地图。这可能都是真的,但是涉及
SurfaceView
的动画效果有很长的问题历史。考虑使用<代码> TrutuVIEW,如果只支持API级别11 +,作为<代码> TrutuVIEW应该对动画更好地工作。我们必须支持姜饼,这不是一个选项。此外,我们需要一个完整的地图功能SurfaceView
android:background="@android:color/transparent"