Multi-line text-views alignment to their baseline (ConstraintLayout Android Studio)

后端 未结 4 1536
日久生厌
日久生厌 2021-02-19 03:53

I have three TextViews \"hi\", \"x\" and \"Hello World\" which I would like to align in the bottom of the Hello World text (ie hi_x_World)

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-19 04:28

    You can use:

    app:layout_constraintBottom_toBottomOf="@+id/helloworldtextid"
    

    Also, don't forget to set the height to wrap_content so that the bottom of the TextViews line up to the bottom of the "Hello World" even when it wraps to two lines or more.

    If you want it centered to "Hello World" when it is multi-line, consider adding

    app:layout_constraintTop_toTopOf="@+id/helloworldtextid"
    

    along with the bottom one. It will center the text to the multi-lined "Hello World" vertically.

提交回复
热议问题