问题是只有在api调用完成后才会加载进度微调器。我想它只是在我返回视图之后才导致出现。 我不知道如何将此添加到对话框之前和正在进行的API调用?在自定义DialogPreference中加载列表视图之前加载进度条
protected View onCreateDialogView() {
subscriptions = null;
LayoutInflater inflater = ((SettingsActivity) ctx).getLayoutInflater();
final View vw = inflater.inflate(R.layout.channel_content_view, null);
header = ((SettingsActivity) ctx).getLayoutInflater().inflate(R.layout.channels_header,null);
((TextView) header.findViewById(R.id.channels_header)).setText("Channels");
LinearLayout linlaHeaderProgress = (LinearLayout) vw.findViewById(R.id.channelsProgress);
linlaHeaderProgress.setVisibility(View.VISIBLE);
// Do this in a new Thread
final ListView lv = (ListView) vw.findViewById(R.id.list);
// ((TextView) lv.findViewById(R.id.channel_desciption)).setText("CHANNELS");
Thread thread = new Thread()
{
@Override
public void run() {
// get the all the channels from api on web
channels = Json.getJson(apiurl + "/rest/channel/"+ linkid +"/"+ username, "GET", null);
}
};
thread.start();
lv.addHeaderView(header);
return vw;
}
channel_content_view.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/channels_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/channelsProgress"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone" >
<ProgressBar
android:id="@+id/pbChannelsProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</ProgressBar>
</LinearLayout>
<ListView
android:id="@+id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants" >
</ListView>
</LinearLayout>
进度条显示做,但它的表盘背后ogview。我该如何使它成为顶尖? – Harry 2013-03-15 07:24:02
我想在对话框中显示加载栏 – Harry 2013-03-15 07:31:27
@Harry这意味着你需要一个自定义的对话框。然后,您将不得不将一个活动显示为一个对话框。我会更新我的答案... – 2013-03-15 08:59:14