Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/13.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中进行连续动画?_Android_Xml_Android Animation - Fatal编程技术网

如何在android中进行连续动画?

如何在android中进行连续动画?,android,xml,android-animation,Android,Xml,Android Animation,我希望我的图像按钮从屏幕的顶部开始,到达屏幕的末端,然后在它后面有另一个图像按钮,这就像道路上的白色条纹一样永远持续下去。当一个按钮到达屏幕末端时,不可见部分必须在屏幕顶部可见,这应适用于每个按钮 请参见最后一个图像按钮的图像,以获得清晰的视图 这是我的XML文件的代码 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res

我希望我的图像按钮从屏幕的顶部开始,到达屏幕的末端,然后在它后面有另一个图像按钮,这就像道路上的白色条纹一样永远持续下去。当一个按钮到达屏幕末端时,不可见部分必须在屏幕顶部可见,这应适用于每个按钮

请参见最后一个图像按钮的图像,以获得清晰的视图

这是我的XML文件的代码

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.ash432.itguesses.options"
android:background="#040404">

<ImageButton
    android:layout_width="5dp"
    android:layout_height="40dp"
    android:id="@+id/im1"
    android:layout_marginLeft="29dp"
    android:layout_marginStart="29dp"
    android:background="#f9f6f6"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layoutAnimation="@anim/layout_anim"
    />

<ImageButton
    android:layout_width="5dp"
    android:layout_height="40dp"
    android:id="@+id/im2"
    android:background="#f9f6f6"
    android:layout_marginTop="26dp"
    android:layout_below="@+id/im1"
    android:layout_alignLeft="@+id/im1"
    android:layout_alignStart="@+id/im1" />

<ImageButton
    android:layout_width="5dp"
    android:layout_height="40dp"
    android:id="@+id/im3"
    android:background="#f9f6f6"
    android:layout_marginTop="26dp"
    android:layout_below="@+id/im2"
    android:layout_alignLeft="@+id/im2"
    android:layout_alignStart="@+id/im2" />

<ImageButton
    android:layout_width="5dp"
    android:layout_height="40dp"
    android:id="@+id/im4"
    android:background="#ffffff"
    android:layout_marginTop="26dp"
    android:layout_below="@+id/im3"
    android:layout_alignLeft="@+id/im3"
    android:layout_alignStart="@+id/im3" />

<ImageButton
    android:layout_width="5dp"
    android:layout_height="40dp"
    android:id="@+id/im5"
    android:background="#ffffff"
    android:layout_marginTop="26dp"
    android:layout_below="@+id/im4"
    android:layout_alignLeft="@+id/im4"
    android:layout_alignStart="@+id/im4" />

<ImageButton
    android:layout_width="5dp"
    android:layout_height="40dp"
    android:id="@+id/im6"
    android:background="#ffffff"
    android:layout_marginTop="26dp"
    android:layout_below="@+id/im5"
    android:layout_alignLeft="@+id/im5"
    android:layout_alignStart="@+id/im5" />

<ImageButton
    android:layout_width="5dp"
    android:layout_height="40dp"
    android:id="@+id/im7"
    android:background="#ffffff"
    android:layout_marginTop="26dp"
    android:layout_below="@+id/im6"
    android:layout_alignLeft="@+id/im6"
    android:layout_alignStart="@+id/im6" />

<ImageButton
    android:layout_width="5dp"
    android:layout_height="40dp"
    android:id="@+id/im8"
    android:background="#ffffff"
    android:layout_marginTop="26dp"
    android:layout_below="@+id/im7"
    android:layout_alignLeft="@+id/im7"
    android:layout_alignStart="@+id/im7" />
更新-

适用于不能正确理解问题的人。

1) 起初,我不想在屏幕上看到任何东西,只想看到背景

2) 过了一段时间,屏幕顶部会出现一条白色的条纹

3) 然后,当它已经完全来了,一段时间后,第二个白色条纹应该看到来了

4) 所有八个图像按钮的步骤相同

5) 现在,当第一个图像按钮到达屏幕底部时。它的大小应该减小,而在屏幕顶部它的大小应该增大。当按钮到达屏幕底部时,所有按钮的大小都应该减小。

6) 条带之间的间隙应保持恒定

以下是显示步骤的图像-


我希望我的问题已经说清楚了。

你的问题不是很清楚,但我想你想回收那些白色条纹

为此,您应该使用RecyclerView

compile 'com.android.support:recyclerview-v7:23.1.1'
在XML中:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.ash432.itguesses.options"
android:background="#040404">

<android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical" />

</RelativeLayout>


是一个很好的资源,您可以学习如何实现recyclerview。

事实上,我是Android新手。所以我不知道如何使用Adapter和Recycler视图。你能详细说明一下吗?我在实现Adapter和Recycler视图时遇到了困难。另外,我的Android Studio不支持回收器视图。你能建议其他方法吗??如果你还没有理解我的问题,也请阅读我的更新。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="com.ash432.itguesses.options"
android:background="#040404">

<android.support.v7.widget.RecyclerView
        android:id="@+id/recycler_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical" />

</RelativeLayout>