安卓:可以静态水平进度条可以嵌入一个TextView? [英] Android: Can a static horizontal progress bar be embedded in a Textview?

查看:276
本文介绍了安卓:可以静态水平进度条可以嵌入一个TextView?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不认为这是可能的,但可以在静态(定)水平进度条可以嵌入一个TextView?

I don't think this is possible, but can a static (determinate) horizontal progress bar be embedded in a Textview?

UPDATE1:我想创建类似于iPhone的进度条,但我也需要它上面的文字。
这里有一个画面: http://i.stack.imgur.com/aDFU9.png

Update1: I am trying to create a progress bar similar to that of the iPhone, but I also need text above it. Here is a picture: http://i.stack.imgur.com/aDFU9.png

UPDATE2:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
<ProgressBar
    style="@android:style/Widget.ProgressBar.Horizontal"
    android:id="@+id/pbar1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:max="100"
    android:progress="45"
    android:maxHeight="5sp"
    android:layout_marginRight="5dp" />
</LinearLayout>

下面是图片: http://i.stack.imgur.com/ypimG.png

现在我的目标是让这个看起来像previous图片。

Now my goal is to make this look like the previous picture.

推荐答案

的TextView 不能包含另一个视图(没有addChild()方法),答案是否定的。

As TextView can't contain another view (there is no addChild() method) the answer is no.

更新:看图片后,你应该使用它包含一个TextView和进度一个的LinearLayout

Update: After looking at the picture, you should use a LinearLayout which contains a TextView and a ProgressBar.

这篇关于安卓:可以静态水平进度条可以嵌入一个TextView?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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