Проблема заключается в том, что счетчик прогресса загружается только после завершения вызова 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
И я хочу показать панель загрузки внутри диалогового окна – Harry
@Harry Это означает, что вам нужен пользовательский диалог. Затем вам нужно будет сделать Activity как диалог. Я обновлю свой ответ ... –