Android的进度条嵌在用户界面,而不是在对话 [英] Android progress bar embedded in ui and not in dialog

查看:116
本文介绍了Android的进度条嵌在用户界面,而不是在对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法嵌入到UI进度条与出一个对话框。
而不是编程但布局的XML文件。
我猜测它是某种动画或绘制

Is there a way to embed the progress bar in the UI with out an dialog. And not programmatically but with layout xml files. I am guessing it has to be some sort of animation or a "drawable"

推荐答案

您可以使用进度部件:

<ProgressBar
    android:id="@+id/a_progressbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

可以,如果你想用自己的形象进行自定义。你只需要创建一个样式文件(RES / styles.xml)是这样的:

You can customize it with your own image if you want. You just have to create a styles file (res/styles.xml) like this:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AProgressBar">
        <item name="android:indeterminateDrawable">@drawable/progress_small</item>
        <item name="android:minWidth">20dip</item>
        <item name="android:maxWidth">20dip</item>
        <item name="android:minHeight">20dip</item>
        <item name="android:maxHeight">20dip</item>
    </style>
</resources>

@绘制/ progress_small 提到 progress_small.png 称为的图像文件。然后,只需修改进度条是这样的:

@drawable/progress_small makes reference to an image file called progress_small.png. Then, just modify your progress bar this way:

<ProgressBar
    android:id="@+id/a_progressbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    style="@style/AProgressBar"/>

这篇关于Android的进度条嵌在用户界面,而不是在对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆