android - Display progress bar beside the text in ListView -
i'm trying make listview progress bar image below
i'm use android:layout_torightof
display progressbar beside pro-xxx-xxx
, display below text .
<?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>
change relativelayout
@chintan answer
you need use tools provided relative layout.
your progressbar needs "torightof" "toendof" textview:
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <relativelayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingtop="10dp"> <textview android:id="@+id/listproject" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingend="20dp" android:paddingright="20dp" android:text="test" android:textcolor="@color/black" android:textstyle="bold"/> <progressbar android:id="@+id/downloadprogressbar" style="?android:attr/progressbarstylehorizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toendof="@id/listproject" android:layout_torightof="@+id/listproject"/> </relativelayout> <textview android:id="@+id/listtimein" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="test"/> <textview android:id="@+id/listtimeout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="test"/> <textview android:id="@+id/listdescription" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="test"/> </linearlayout>
i have tested xml, , works well.
Comments
Post a Comment