Manoj Perumarath
Manoj Perumarath

Reputation: 10214

How to remove default margin of ConstraintLayout in Compound View?

I had created a custom compound view for which a default padding is appearing on the ConstraintLayout Here is the layout

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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:layout_margin="0dp"
android:background="@color/red_wrong"
android:orientation="vertical"
android:padding="0dp">

<TextView
    android:id="@+id/tv_hint"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:fontFamily="@font/ubuntu"
    app:layout_constraintBottom_toTopOf="@id/et_input"
    app:layout_constraintStart_toStartOf="@id/et_input" />

<EditText
    android:id="@+id/et_input"
    android:layout_width="0dp"
    android:layout_height="@dimen/dimen50"
    android:layout_margin="0dp"
    android:background="@color/material_yellow50"
    android:fontFamily="@font/ubuntu"
    android:padding="0dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<ImageView
    android:id="@+id/iv_add_view"
    android:layout_width="@dimen/dimen20"
    android:layout_height="@dimen/dimen20"
    app:layout_constraintBottom_toTopOf="@id/et_input"
    app:layout_constraintEnd_toEndOf="@+id/et_input"
    app:srcCompat="@drawable/ic_add" />
 </androidx.constraintlayout.widget.ConstraintLayout>

enter image description here

I have also tried applying 0dp as margin. What I need is to get rid of that bottom margin.

Upvotes: 0

Views: 591

Answers (0)

Related Questions