- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Android 中,我有一个带有设置菜单的屏幕,当加载屏幕时,我使用 ProgressDialog
显示消息“请等待。屏幕加载时”,直到搜索完成。
我想在搜索当前打开并且 ProgressDialog
仍在屏幕上显示时访问屏幕中的设置菜单。
我尝试了 progressDialog.cancel()
,但这隐藏了进度对话框消息,然后允许我进入菜单。但我想在访问菜单时显示对话框消息。是否可以在用户访问设置菜单时显示进度对话框消息。
最佳答案
根据您的要求,您可能不应该使用 ProgressDialog
,因为它会“锁定”用户操作,直到您取消它(或者用户通过按后退按钮将其关闭)。
另一种解决方案是创建一个具有居中的 ProgressBar
和一个 TextView
的 View ,并将其初始可见性设置为 GONE
,然后一次当您开始加载搜索时,您可以将此 View 可见性更改为 VISIBLE
并将其他所有内容更改为 GONE
(除了您希望显示的内容,例如菜单)。
话虽如此,您会得到类似于下面的屏幕截图的内容:
这样,用户将能够与屏幕上的其他组件进行交互,例如访问设置菜单。
XML代码如下:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="LOADING..."
app:layout_constraintTop_toBottomOf="@+id/progressBar"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"/>
</android.support.constraint.ConstraintLayout>
关于ProgressDialog 显示在屏幕上时的 Android 多任务处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44318324/
希望是一个简单的问题,但我没有 iOS3/不支持设备多任务处理。 我的应用程序现在设置为在后台运行(播放音频),我有一个正在运行的动画,我通过 applicationDidEnterBackgroun
在 Android 中,我有一个带有设置菜单的屏幕,当加载屏幕时,我使用 ProgressDialog 显示消息“请等待。屏幕加载时”,直到搜索完成。 我想在搜索当前打开并且 ProgressDial
我想每 5 分钟拍一张照片,但应用程序必须在后台运行。出于完全合法的原因。 这可能吗? 我愿意去天涯海角去实现我的目标,如果一个公众不能实现这个目标,一个企业实体是否可以实现这个目标。 app设计有a
我正在以编程方式创建一些 UI,其中涉及一些繁重的处理。基本上我想要的是在我的 UI 正在构建/添加到窗口时运行加载器动画。添加的 UI 是一些网格和正在加载到其中的一些图像。 到目前为止,我已经尝试
我正在编写一个录制音频的应用程序。我正在研究在进行录音(在后台)时支持多任务处理的可行性。 从我目前所读的内容来看,答案似乎是否,特别是因为该程序旨在释放在关闭时正在使用的任何系统资源。 所以我想知道
在 PHP 中,我们通常在不考虑服务器功能的情况下进行编码。现在甚至 PC 也有多个内核并处理 64 位数据。据我所知,PHP 引擎本身经过优化以利用多核。我们程序员如何才能进一步优化代码以利用多核。
我正在尝试使用 iPhone OS 4.0 的多任务处理功能。我尝试在后台播放音频但没有成功。我在 info.plist 中添加了 UIBackgroundModes 属性,并提到需要在后台播放音频。
iOS 应用程序如何知道应用程序打开时屏幕上是否已经有键盘?应用程序运行后,它可以接收键盘显示/隐藏通知。但是,如果应用程序在分屏模式下作为辅助应用程序打开,而主应用程序已经显示键盘,则辅助应用程序不
当我的应用程序成为焦点应用程序时,它会收到 UIKeyboardDidShowNotification 和相关通知。但是,如果另一个应用程序专注于拆分的多任务 View ,它就不再接收它。我在模拟器中
我想知道 Lua 是否内置了抢占式多任务处理功能。我希望在我的多核系统上使用并发线程。 我研究了协程(参见 lua-users.org/wiki/CoroutinesTutorial 和 stacko
有没有办法选择加入 iOS 9 并排多任务而不选择滑入? 背景是我们的应用程序 UI 在并排模式下处理得很好,但在狭窄的滑过模式下根本无法正常工作。该应用程序主要是一个 PDF 注释器,因此从用户体验
我有一个带有 Adafruit Motor Shield 的 Arduino 作为我的机器人的一部分。我想在运行电机的同时在压电元件上播放音调。 问题是我不太清楚如何在我的代码中伪造/模拟多任务处理。
我想将 app 作为我在 ios 7 上的硕士论文,但我需要知道是否可以在后台运行相机。我需要在用户按下主页按钮后录制视频(当用户使用另一个应用程序时,它应该是汽车的交通摄像头,例如导航)。我知道这在
在我的应用程序中,我尝试获取新内容并使其保持最新,即使我的应用程序处于待机模式也是如此。为此,我想使用新的多任务处理 iOS 7 功能。 首先,我通过将 key fetch 添加到 Info.plis
在 iOS 4 中,当用户按下主页按钮时,正在运行的应用程序将保存当前状态并转到后台。但是我正在开发一个应用程序,我不希望它进入后台。我希望它自杀,就像在 iOS 3 及之前的版本中一样。我该怎么做?
我正在开发一个 iPhone 应用程序,它使用背景音频(无限循环)在应用程序进入后台后继续播放。 我的问题是我想实现一个“ sleep 定时器”,它会在指定时间后停止播放。 这可能吗?我花了一个小时寻
有谁知道在应用程序失去焦点(按下主页按钮时)后如何让音频流播放(从 AVPlayer 组件中的 webview 或)?在 iOS 4.2 中。我知道我必须阅读有关多任务处理的内容,但如果您能针对该特定
以前,如果一个人在自己的应用程序上显示一个键盘,那么他会将所有内容嵌入到 UIScrollView 中。并调整 contentInset以防止内容被键盘遮挡。 现在有了 iOS 9 上的 Split
我正在使用 Cordova 创建一个应用程序,我希望我的 iPad 应用程序能够使用这个名为“Split View”又名“Apps Side by Side”或“multitasking”的很酷的功能
我看过 WWDC 2010 关于采用多任务处理的讨论,并且我已经开始启用我们的应用程序,但是我对释放不可见 View 有疑问。 根据演讲(第 105 节 - 在 iPhone 操作系统上采用多任务处理
我是一名优秀的程序员,十分优秀!