【发布时间】:2013-12-23 07:42:31
【问题描述】:
我在菜单中显示了一个进度微调器。我想在微调器中显示一个数字,我该怎么做?以下是我正在做的一些代码 sn-ps 以使进度微调器工作:
public void onCreateOptionsMenu(...) {
...
if (uploadCount > 0) {
MenuItem updatingMenuItem = menu.findItem(R.id.photo_capture_action_updating);
updatingMenuItem.setActionView(R.layout.action_progressbar);
updatingMenuItem.expandActionView();
} else {
menu.removeItem(R.id.photo_capture_action_updating);
}
}
下面是action_progressbar.xml
<?xml version="1.0" encoding="utf-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ProgressBar>
谢谢,
【问题讨论】:
-
您可以为此使用相对布局,并在背景中使用 textview,在前面您可以加载微调器。类似于该用户建议的加载图像stackoverflow.com/questions/18964799/…