as the title states i do have an view which looks as the following:
attachment_main.xml
<TextView
android:id="@+id/Frage_attachment"
android:layout_width="370dp"
android:layout_height="59dp"
android:text="Frage Attachment "
android:textSize="30sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.609"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.343" />
<Button
android:id="@+id/button_attachment"
android:layout_width="112dp"
android:layout_height="59dp"
android:text="OK"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.214"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.572" />
This view is included in a new view as the following:
<include
android:id="@+id/idAttachment"
layout="@layout/attachment_main"
android:layout_width="549dp"
android:layout_height="808dp"
android:visibility="visible" />
Question: In the new view, i would like to put the content of the include at the center of the screen. How do i make it happen?
You only need to have the next
<include
android:id="@+id/idAttachment"
layout="@layout/attachment_main"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:visibility="visible" />
Please not use width with fix, because you can have different resolution
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.