問題描述
我目前在我的應(yīng)用程序中使用可能需要一秒鐘才能顯示的列表視圖.
I am currently using in my application a listview that need maybe one second to be displayed.
我目前所做的是使用列表視圖的@id/android:empty 屬性來創(chuàng)建加載"文本.
What I currently do is using the @id/android:empty property of the listview to create a "loading" text.
<TextView android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF0000"
android:text="Loading..."/>
現(xiàn)在,我想用加載對話框中使用的動畫圓圈代替這段文字,我想你們都知道我的意思:
Now, I would like to replace that with the animated circle that is used in a loading dialog instead of this text, i guess you all know what I mean:
我不想要對話.我想在我的布局中展示它.
I do not want a dialog. I want to show that inside my layout.
非常感謝您的幫助!
推薦答案
只需將此塊 xml 放入您的活動布局文件中即可:
Simply put this block of xml in your activity layout file:
<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>
當你完成加載時,調(diào)用這一行:
And when you finish loading, call this one line:
findViewById(R.id.loadingPanel).setVisibility(View.GONE);
結(jié)果(它也會旋轉(zhuǎn)):
這篇關(guān)于使用“動畫圈"在加載內(nèi)容時在 ImageView 中的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!