Adi*_*Adi 0 android android-layout android-progressbar progress-bar android-recyclerview
这是我的布局 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" />
Run Code Online (Sandbox Code Playgroud)
它在回收视图中显示图像网格。我可以选择一堆图像并可以选择删除它们。以下是删除逻辑:
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();
}
Run Code Online (Sandbox Code Playgroud)
我希望在删除操作进行时进度条显示在前台。但它只是不显示。任何帮助将不胜感激。
小智 10
所以我以前遇到过这个问题。就我而言,这是因为我在整个应用程序中使用了 Material Design 主题,所以我不得不使用特定的方向,它解决了我的问题。你可以试试
<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"/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6461 次 |
| 最近记录: |