Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/197.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_Animation_Android Animation - Fatal编程技术网

Android 帧动画从中心向外绘制

Android 帧动画从中心向外绘制,android,animation,android-animation,Android,Animation,Android Animation,当我拉刷新列表时,我的进度条动画看起来很奇怪。您可以看到下面的屏幕截图 我使用了8帧来模拟不确定模式下的刷新动画,但刷新圆动画绘制错误。 我想知道为什么会发生这种情况,为什么这是圆圈底部的一条暗线 进度条语句 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" androi

当我拉刷新列表时,我的进度条动画看起来很奇怪。您可以看到下面的屏幕截图

我使用了8帧来模拟不确定模式下的刷新动画,但刷新圆动画绘制错误。 我想知道为什么会发生这种情况,为什么这是圆圈底部的一条暗线

进度条语句

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical">

    <RelativeLayout
            android:id="@+id/head_contentLayout"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:paddingTop="10dip"
            android:paddingBottom="15dip">

        <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:layout_marginLeft="30dip"
                android:layout_marginRight="20dip">

            <ImageView
                    android:id="@+id/head_arrowImageView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:src="@drawable/pulltorefresh_arrow"/>

        </FrameLayout>

        <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_alignParentLeft="true"
                android:layout_centerVertical="true"
                android:paddingTop="10dip"
                android:paddingBottom="15dip"
                android:layout_marginLeft="100dip"
                android:layout_marginRight="10dip">

            <ProgressBar
                    android:id="@+id/head_progressBar"
                    style="@style/loading_small"
                    android:visibility="gone"/>

        </FrameLayout>

        <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:gravity="center_horizontal"
                android:orientation="vertical">

            <TextView
                    android:id="@+id/head_tipsTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/pull_to_refresh_pull_label"
                    android:textColor="@color/black"/>

            <TextView
                    android:id="@+id/head_lastUpdatedTextView"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="@color/black"
                    android:textSize="10sp"/>

        </LinearLayout>
    </RelativeLayout>


</LinearLayout> 

样式文件

<style name="loading_small" parent="@android:style/Widget.ProgressBar.Small">
    <item name="android:indeterminateDrawable">@anim/pull_to_refresh_header_loading</item>
    <item name="android:layout_width">41dip</item>
    <item name="android:layout_height">41dip</item>
    <item name="android:layout_gravity">center_vertical</item>
</style>

@动画/拉至刷新标题加载
41度
41度
中心垂直
用于动画列表的项目

    <?xml version="1.0" encoding="UTF-8"?>
<animation-list android:oneshot="false"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:duration="100" android:drawable="@drawable/loading_0" />
    <item android:duration="100" android:drawable="@drawable/loading_1" />
    <item android:duration="100" android:drawable="@drawable/loading_2" />
    <item android:duration="100" android:drawable="@drawable/loading_3" />
    <item android:duration="100" android:drawable="@drawable/loading_4" />
    <item android:duration="100" android:drawable="@drawable/loading_5" />
    <item android:duration="100" android:drawable="@drawable/loading_6" />
    <item android:duration="100" android:drawable="@drawable/loading_7" />
</animation-list> 

奇怪的提神圈

用于装配圆的框架之一


删除框架布局的填充。并设置hight和width以分别为大小包装内容和裁剪ur图像(宽度和高度分别为15和21 dp)大小。因为它将帮助你实现设备兼容性

试试这个

<style name="loading_small" parent="@android:style/Widget.ProgressBar.Small">
    <item name="android:indeterminateDrawable">@anim/pull_to_refresh_header_loading</item>
    <item name="android:layout_width">41dip</item>
    <item name="android:layout_height">41dip</item>
    <item name="android:layout_centerVertical">true</item>
</style>

@动画/拉至刷新标题加载
41度
41度
真的

我测试这个方法时运气不佳。当我尝试将宽度和高度更改为
13dip
时,进度条可以正确地显示围绕中心的每帧,但问题是
13dip
宽度太小,看起来像一个点,非常紧密。我尝试删除填充,但仍然无法修复。感谢您的Pantice在styles xml中删除填充并将宽度和高度分别更改为15和21 dp后,问题得到了解决。