Ask Your Question
3

What is the solution for the missing attribute app:constraintBottom_toBottomOf?

asked 2023-07-08 14:03:17 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-07-08 14:14:01 +0000

devzero gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-08 14:03:17 +0000

Seen: 7 times

Last updated: Jul 08 '23