gpt4 book ai didi

android - 在加载内容时在 ImageView 中使用 "animated circle"

转载 作者:IT老高 更新时间:2023-10-28 12:52:54 25 4
gpt4 key购买 nike

我目前在我的应用程序中使用可能需要一秒钟才能显示的 ListView 。

我目前所做的是使用 ListView 的@id/android:empty 属性来创建“加载”文本。

 <TextView android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF0000"
android:text="Loading..."/>

现在,我想用加载对话框中使用的动画圆圈代替这段文字,我想你们都知道我的意思:

编辑:我不想要对话。我想在我的布局中展示它。

http://flexfwd.com/DesktopModules/ATI_Base/resources/images/loading_blue_circle.gif

非常感谢您的帮助!

最佳答案

只需将此 xml block 放入您的 Activity 布局文件中:

<RelativeLayout
android:id="@+id/loadingPanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" >

<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true" />
</RelativeLayout>

当你完成加载时,调用这一行:

findViewById(R.id.loadingPanel).setVisibility(View.GONE);

结果(它也会旋转):

enter image description here

关于android - 在加载内容时在 ImageView 中使用 "animated circle",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5442183/

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