The solution for the missing attribute app:constraintBottom_toBottomOf is to add it to the relevant XML layout element in the layout file. This attribute specifies the bottom constraint of a view to another view or a guideline, and is a part of the ConstraintLayout system in Android. Here is an example of how to use this attribute to constrain a view to the bottom of a guideline:
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline_bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.8" />
<TextView
android:id="@+id/text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World"
app:layout_constraintBottom_toBottomOf="@id/guideline_bottom"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
In this example, the guideline with the id guidelinebottom is defined and set to be 80% down the height of the parent view. The text view is then constrained to the bottom of this guideline using the app:layoutconstraintBottom_toBottomOf attribute. This ensures that the bottom of the text view is always positioned at 80% down the height of the parent view.
Asked: 2023-07-08 14:03:17 +0000
Seen: 7 times
Last updated: Jul 08 '23