gpt4 book ai didi

Android ViewFlipper ZOrder

转载 作者:太空狗 更新时间:2023-10-29 15:23:33 27 4
gpt4 key购买 nike

我正在尝试使用 View 翻转器为 2 个 View 之间的转换设置动画。看起来,默认情况下,ViewFlipper 将 Out 动画按 Z 顺序放置在 In 动画上方。有没有办法让传入的动画显示在传出的动画之上?

谢谢

最佳答案

您可以在 Android 启动器中找到此功能。由于 Android 是开源的,您可以复制并使用它。

以名为 DragableSpace 的代码为例:http://pastebin.com/CgK8TCQS .在您的 Activity 中,您调用:

setContentView(R.layout.main);

与:

<?xml version="1.0" encoding="utf-8"?>
<de.android.projects.DragableSpace
xmlns:app="http://schemas.android.com/apk/res/de.android.projects"
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/space"
android:layout_width="fill_parent" android:layout_height="fill_parent"
app:default_screen="1">
<include android:id="@+id/left" layout="@layout/left_screen" />
<include android:id="@+id/center" layout="@layout/initial_screen" />
<include android:id="@+id/right" layout="@layout/right_screen" />
</de.android.projects.DragableSpace>

如您所见,您可以仅使用 xml 为您的应用程序定义一个主屏幕 ;)

定义每个 View (初始、右侧和左侧) 像这样:

<LinearLayout android:id="@+id/center"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:background="@color/orange">
<Button android:text="Initial Screen" android:id="@+id/Button2"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:padding="10dp" android:layout_margin="10dp">
</Button>
</LinearLayout>

有关更多信息,请查看此问题:Developing an Android Homescreen

关于Android ViewFlipper ZOrder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4810157/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com