Tran Ngu Dang
Tran Ngu Dang

Reputation: 2630

Progressbar on bottom of listview item

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@id/explorer_fIcon"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:contentDescription="@null"
        android:padding="3dp" />

    <TextView
        android:id="@id/explorer_fName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginRight="40dp"
        android:layout_toRightOf="@id/explorer_fIcon"
        android:ellipsize="marquee"
        android:singleLine="true"
        android:textStyle="bold" />

    <CheckBox
        android:id="@id/explorer_checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:clickable="false"
        android:focusable="false"
        android:visibility="gone" />

     <ProgressBar
        android:id="@+id/drawer_progressbar2"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:clickable="false"
        android:progress="40" /> 

</RelativeLayout>

The Progressbar has android:layout_alignParentBottom="true" but it is not on the bottom

enter image description here

How can I make that progressbar on the bottom, i mean on top the the divider ?

Update: I add the divider attr in the Listview:

<ListView
    android:id="@+id/left_drawer_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:choiceMode="singleChoice"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:fastScrollEnabled="false" />

But it still does not work

Update 2: thanks a lot. Here is the final answer I get from u:

 <ProgressBar
    android:id="@+id/drawer_progressbar2"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@id/explorer_fIcon"
    android:layout_marginBottom="-7dp"
    android:clickable="false"
    android:progress="40"
    android:visibility="visible" /> 

Upvotes: 0

Views: 1000

Answers (3)

Faruk Yazici
Faruk Yazici

Reputation: 2404

ProgressBar is a view that has a container which has extra padding event it's height is set to wrap_content. So I don't think there is a way other than giving it a minus margin;

android:layout_marginBottom="-7dp"

So, change your ProgressBar like this;

 <ProgressBar
    android:id="@id/drawer_progressbar2"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="-7dp"
    android:layout_alignParentBottom="true"
    android:clickable="false"
    android:progress="40" /> 

It should work.

Upvotes: 1

Droidekas
Droidekas

Reputation: 3504

you could try the other way around,make the divider dissappear.In your parent list view xml add:

   android:dividerHeight="0dp"

Upvotes: 0

AmniX
AmniX

Reputation: 653

1.Aling Your Progress bar below of Explorer Icon and margin it from top a little,

2.Now on your Listview, Hide divider with set divider height to 0px

3.Now your Progressbar should act like a divider.

It Should work, Let me know if it works or doesn't works.

Upvotes: 1

Related Questions