Reputation: 45
How to make progressBar
align bottom edge of listitem without any margin.
I dont know how to place it to become bottom edge of ListItem. android:layout_alignParentBottom
is not working how it should, still have ~4dp bottom margin.
Below XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/zam_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/listview_selector"
android:longClickable="true" >
<ImageView
android:id="@+id/zam_status"
android:layout_width="160dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:scaleType="centerInside"
android:src="@drawable/status_zrealizowane"
android:visibility="visible" />
<RelativeLayout
android:id="@+id/relLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false" >
<TextView
android:id="@+id/mz_kod"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/mz_numer"
android:layout_marginRight="3dp"
android:layout_toLeftOf="@+id/linright"
android:ellipsize="marquee"
android:lines="1"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:text="@string/title_kontrahent_detail"
android:textColor="#000"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/mz_numer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="2dp"
android:layout_marginRight="3dp"
android:layout_marginTop="2dp"
android:layout_toLeftOf="@+id/linright"
android:layout_toRightOf="@+id/roz_photo"
android:ellipsize="marquee"
android:lines="1"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="false"
android:text="@string/kontrahenci_kod"
android:textColor="@color/blue"
android:textSize="18sp" />
<ImageView
android:id="@+id/roz_photo"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:contentDescription="@string/app_name"
android:src="@drawable/lista_zam" />
<LinearLayout
android:id="@+id/linright"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:gravity="right"
android:orientation="vertical" >
<TextView
android:id="@+id/mz_wartosc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Wartość"
android:textSize="12sp" />
<TextView
android:id="@+id/mz_ilosc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ilość"
android:textSize="12sp" />
</LinearLayout>
</RelativeLayout>
<ProgressBar
android:id="@+id/mz_progress"
android:layout_width="match_parent"
android:layout_height="4dp"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_marginBottom="-5dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
Thanks a lot!
P.S. i know that "-5dp" margin wont work :)
Upvotes: 0
Views: 1110
Reputation: 29285
It seems you ProgressBar
is suffering from one its ancestors' paddings. Make your all its parents have padding_bottom
set to 0
.
Also add zero padding to that ProgressBar
and see whether it sticks to the bottom or not.
Upvotes: 0
Reputation: 75788
You can create RelativeLayout
and remove android:layout_marginBottom="-5dp"
<RelativeLayout
android:id="@+id/RelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<ProgressBar
android:id="@+id/mz_progress"
android:layout_width="match_parent"
android:layout_height="4dp"
style="@android:style/Widget.ProgressBar.Horizontal"
/>
</RelativeLayout>
Upvotes: 1