Reputation: 1648
I'm trying to position a TextView to the bottom of ConstraintLayout, but although I put app:layout_constraintHorizontal_bias="1.0"
there are a kind of 'marging' of 'padding' as you can see on the image below:
The constraint to the bottom, adds this padding and I'm unable to remove it. This is my XML:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="vertical"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="10dp">
<de.hdodenhof.circleimageview.CircleImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/picture"
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/ic_launcher_background"
app:civ_border_color="#FF000000"
app:civ_border_width="2dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
<TextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:layout_marginStart="8dp"
android:layout_weight=".90"
android:ellipsize="end"
android:maxLines="2"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:singleLine="false"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="@+id/picture"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toEndOf="@+id/picture"
app:layout_constraintTop_toTopOf="@+id/picture"
app:layout_constraintVertical_bias="0.0" />
<ImageView
android:id="@+id/badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:src="@drawable/orange_badge"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.08"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
android:contentDescription="notificationBadge" />
<TextView
android:id="@+id/status"
android:layout_height="23dp"
android:layout_alignParentBottom="true"
android:layout_marginTop="24dp"
android:gravity="bottom|end"
android:maxLines="1"
android:singleLine="true"
android:textSize="12sp"
android:layout_width="133dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />
</android.support.constraint.ConstraintLayout>
The TextView that I'm trying to place at the bottom is @+id/status
.
Thank you in advance.
Upvotes: 1
Views: 1274
Reputation: 54204
Your <ConstraintLayout>
tag defines these attributes:
android:paddingBottom="16dp"
android:paddingRight="16dp"
This is the extra space you see. You will have to remove this padding from the parent view, and add margins to the children in order to achieve the same visual effect without causing every child to be inset.
Upvotes: 2
Reputation: 389
Remove the line android:paddingBottom="16dp" in the main ConstrainLayout element
Upvotes: 1