こんにちは私はLinearLayoutとして親のレイアウトを持っていて、私は中央に画像ビューを配置し、その2つのテキストビューを画面の中央で次々に配置する必要があります。画面の下部にアイコンがあります。イメージビューと、画面の中央にある2つのテキストをどのように整列させるか?
イメージビュー以外のすべてを配置し、2つのテキストビューが画面の中央に配置されていません。ここにレイアウトがあります。
<?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、2つのテキストが画面の中央に配置されず、画面の上部に配置されます。
のLinearLayout子のLinearLayoutから 'layout_gravity' と '重力' のパラメータを切断して親にこれを貼り付け、これを試してください取得?ショー画面 – Gattsu