안녕하세요, 저는 LinearLayout과 같은 부모 레이아웃을 가지고 있으며, 화면 중앙에 이미지 뷰를 배치해야합니다. 화면 하단에는 아이콘이 있습니다.안드로이드의 화면 중앙에 imageview와 두 개의 텍스트를 정렬하는 방법은 무엇입니까?
이미지 뷰를 제외한 모든 요소를 배치했으며 두 개의 텍스트 뷰가 화면 가운데에 정렬되지 않았습니다. 다음은 레이아웃입니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/bg"
android:orientation="vertical">
//this image and two textview, i need to place at center of screen
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:orientation="vertical">
<ImageView
android:id="@+id/seat_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/on_logo"
android:layout_marginBottom="@dimen/dp_size20"
/>
<TextView
android:id="@+id/seat_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test1"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="16dp"
android:gravity="center"/>
<TextView
android:id="@+id/another_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/dp_size10"
android:paddingBottom="@dimen/dp_size10"
android:text="TEst 2"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="16dp"
android:gravity="center"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_size10">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="1"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true">
<ImageView
android:id="@+id/on_boarding_circle_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_centerInParent="true"
android:background="@drawable/circle_arrow" />
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
나는이 디자인에서 내가하는 실수를 정말로 알 수 없었다. ImageView 및 두 개의 텍스트가 화면의 중앙에 배치되지 않고 화면의 맨 위에 배치됩니다.
의 LinearLayout 부모이 붙여 넣기 점점? 쇼 화면 – Gattsu