In my App, I want some child view ignore parent view padding.
For Example:
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="86dp"
android:clipToPadding="false"
android:padding="8dp">
<TextView
android:id="@+id/history_restart"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginBottom="-8dp"
android:layout_marginTop="-8dp"
android:gravity="center"
android:paddingLeft="27dp"
android:paddingRight="27dp"
android:text="@string/history_restart_action_text"
android:textColor="@color/colorAccent"
android:textSize="@dimen/normal_text_size"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
Tried it but not working :(
This is impossible. Your parent view has a fixed height. Adding the padding means that the greatest height it will assign to its children will be
86dp - 2 * 8dp = 70dp
. Using negative margin will only move your view around. It will not change the height it gets. So will never fill the parent.You have to give up the padding attribute and instead use margins on every other view inside your layout.