アンドロイドデベロッパースタジオを使用して、次のスプラッシュ画面レイアウトを作成しました。私は、2つのテキストビューとイメージビューからなるコンテンツを中心にしたいと思っていました。以下はXMLです。アンドロイドのリニアレイアウトにコンテンツを配置する最も良い方法
<?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"
android:background="@drawable/splash_gradient">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView id="@+id/splashscreen"
android:layout_width="100dp"
android:layout_height="250dp"
android:paddingBottom="100dp"
android:layout_centerInParent="true"
android:gravity="center_vertical|center_horizontal"
android:src="@drawable/splash_logo" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sample"
android:layout_centerInParent="true"
android:fontFamily="@string/font_family_thin"
android:paddingTop="90dp"
android:paddingRight="90dp"
android:textSize="35dp"
android:textColor="#fff"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="App"
android:layout_centerInParent="true"
android:fontFamily="@string/font_family_regular"
android:textSize="35dp"
android:paddingTop="90dp"
android:paddingLeft="100dp"
android:textColor="#fff"
/>
</RelativeLayout>
これは、以下の画像のようになります。
これは私のコンテンツを中央にするための正しい方法ですか私が探しているものを達成するためのより良い方法はありますか?私を案内してください。前もって感謝します。
私は私の正確な設計を得るためにあなたの答えを少し変更しましたし、それが完璧に見えます。このAndroidのレイアウトで素晴らしいUIを取得する方法に関するドキュメントに私を導いてください。私はグーグルで、基本的なチュートリアルしか見つかりませんでした。 –
私は特にチュートリアルを思い出しません。しかし、各レイアウトに固有のtutorias(FrameLayout、LinearLayout、RelativeLayout、およびConstraintLayout)を検索します。この最後のものは、より多くの選択肢を持つものですが、最も複雑なものですので、最初のものに慣れ親しんでいただきたいと思います。 – Juan
よろしいですか?どうもありがとうございました! :) –