gpt4 book ai didi

android - 自定义 ProgressBar 旋转不流畅

转载 作者:行者123 更新时间:2023-11-30 02:50:09 24 4
gpt4 key购买 nike

查看this question ,我创建了以下文件:

res/drawable/spinner.xml

<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/loading"
android:pivotX="50%"
android:pivotY="50%"
android:repeatCount="infinite"
android:fromDegrees="0"
android:toDegrees="718"
android:fillAfter="false"
android:startOffset="0"
android:interpolator="@android:anim/linear_interpolator"
/>

res/layout/layout.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<ProgressBar
android:id="@+id/splashSpinnerImageView"
android:layout_width="260dp"
android:layout_height="260dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminateDrawable="@drawable/spinner"
/>

</RelativeLayout>

微调器仍然在旋转时出现明显的问题,而且不是很顺畅。我用 Sony Xperia S 和 Z2 对其进行了测试,它具有相同的行为。

我可以做些什么来增加 ProgressBar 的平滑度?我应该将 ProgressBar 转换为 ImageView 和/或以编程方式启动动画吗?

TIA

更新:

我尝试在我的项目中使用默认的 android 的 progress_large.xml,但是最“有趣”的属性

android:framesCount="12"
android:frameDuration="100"

无法找到,因为它们被定义为私有(private)

最佳答案

我在其他地方发现了一个问题。对于最顶层的 RelativeLayout,我使用 PNG 1080x1920 作为背景。它的重量为 480 kB,即使是默认的“ProgressBar”——感谢#pskink 的提示——也随着打嗝而旋转。

然后我尝试将它缩小到 720x1280 像素分辨率 @ 360 kB,而且 - 神奇! - 旋转器开始平稳旋转!

Android 似乎对高分辨率图片有问题...

关于android - 自定义 ProgressBar 旋转不流畅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24344526/

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