就可以實現這一個取巧的辦法,針鋒相對工作對我來說..
在佈局文件,該文件規定了標籤內容,把進度條作爲:
<?xml version="1.0" encoding="utf-8"?>
<Layout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
<ListView
android:id="@+id/updatesList"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ListView>
<ProgressBar
android:id="@+id/progressbar"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</FrameLayout>
</LinearLayout>
,並在活動的tat顯示選項卡的內容,顯示在清單或通過進度條(僅一次一個):
if(list != null){
progressBar.setVisibility(View.INVISIBLE);
updatesListView.setVisibility(View.VISIBLE);
adapter = new YourListAdapter(this, list);
updatesListView.setAdapter(adapter);
} else{
progressBar.setVisibility(View.VISIBLE);
updatesListView.setVisibility(View.INVISIBLE);
new Thread(downloadListContent).start();
}
和下載線程完成後,通過一個處理程序或runOnUIThread ,使可視性扭轉爲
progressBar.setVisibility(View.INVISIBLE);
updatesListView.setVisibility(View.VISIBLE);
此後嘗試插入了android標籤also..It將幫助用戶輕鬆找到您的問題... – Aravindhan