【发布时间】:2016-01-21 04:32:55
【问题描述】:
我正在尝试制作一个与下图完全一样的带有进度条的 listView
我使用android:layout_toRightOf 在Pro-XXX-XXX 旁边显示进度条,但它显示在文本下方。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/ListProject"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ProgressBar
android:id="@+id/downloadProgressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/ListProject" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/blue"
android:id="@+id/ListTimeIn"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/blue"
android:layout_toLeftOf="@+id/ListTimeIn"
android:id="@+id/ListTimeOut"/>
<TextView android:id="@+id/ListDescription"
android:layout_width="wrap_content"
android:textColor="@color/blue"
android:layout_height="wrap_content"/>
</LinearLayout>
更改为相对布局
@Chintan 回答
【问题讨论】:
-
那么你这样做有什么问题?
-
@Sree 我想在 Pro-XXX 旁边显示进度条
-
尝试将 LinearLayout 更改为相对布局。
-
你有很多方法可以做到这一点,尽力而为
-
在你的 TextView 中添加这个 android:lines="2"。我还编辑了我的答案。请检查。 @Sengspan>
标签: android xml progress-bar android-progressbar