Панель Android Progress не отображается - PullRequest
0 голосов
/ 10 ноября 2018

Это мой макет xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/fragment_body"
android:fitsSystemWindows="true">

<include
    android:id="@+id/contextToolBar"
    layout="@layout/context_toolbar_layout" />

<android.support.v7.widget.RecyclerView
    android:id="@+id/list1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/contextToolBar"
    android:scrollbarSize="5dp"
    android:scrollbarThumbVertical="@color/scrollbarColor"
    android:scrollbars="vertical"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

<ProgressBar
    android:id="@+id/delete_progress"
    style="@style/Widget.AppCompat.ProgressBar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:visibility="gone" />

Отображает сетку изображений в обзоре переработчика. Я могу выбрать кучу изображений и иметь возможность удалить их. Ниже приведена логика удаления:

public void deleteSelectedFiles(final Context context, final List<MediaModel> selectionList) {

    String confirmationMessage = getString(R.string.delete_confirm_message);

    new AlertDialog.Builder(context)
            .setTitle(getString(R.string.action_delete))
            .setMessage(confirmationMessage)
            .setIcon(android.R.drawable.ic_dialog_alert)
            .setPositiveButton(android.R.string.yes, (dialog, whichButton) -> {
                View progressBar = getActivity().findViewById(R.id.delete_progress);
                dialog.cancel();
                progressBar.setVisibility(View.VISIBLE);

                deleteFileList(selectionList, this.getActivity());

                progressBar.setVisibility(View.GONE);
            })
            .setNegativeButton(android.R.string.no, null).show();
}

Я ожидаю, что индикатор выполнения будет отображаться на переднем плане во время операции удаления. Но это просто не появляется. Любая помощь будет принята с благодарностью.

1 Ответ

0 голосов
/ 07 февраля 2019

Так что у меня была эта проблема раньше. В моем случае это было потому, что я использовал тему дизайна материала для всего приложения, поэтому мне пришлось использовать определенную ориентацию, и это решило мою проблему. Вы можете попробовать с

<ProgressBar
                android:id="@+id/progressBarReady"
                style="@android:style/Widget.ProgressBar.Horizontal"
                android:layout_width="match_parent"
                android:layout_height="3dp"
                android:indeterminate="true"
                android:visibility="visible"/>
...