画像を均等に並べる方法です。
縦画面でも横画面でも対応できます。
動画リスト
この動画はシリーズ物です。以下の順にご覧ください。
縦横画面対応
画面が縦でも横でもそれなりに見える作りを目指します。
使用素材
![RPG画面 使用素材 モンスター](http://hakoniwadesign.com/wp-content/uploads/2015/12/m0-150x150.png)
![RPG画面 使用素材 プレーヤー](http://hakoniwadesign.com/wp-content/uploads/2015/12/p0-150x150.png)
![RPG画面 使用素材 ヒロイン](http://hakoniwadesign.com/wp-content/uploads/2015/12/p1-150x150.png)
![RPG画面 使用素材 武器屋](http://hakoniwadesign.com/wp-content/uploads/2015/12/p2-150x150.png)
![RPG画面 使用素材 雑貨屋](http://hakoniwadesign.com/wp-content/uploads/2015/12/p3-150x150.png)
![RPG画面使用素材 背景](http://hakoniwadesign.com/wp-content/uploads/2015/12/back-150x150.jpg)
レイアウト解説
レイアウトや画像の並びを確認しておきます。
activity_main.xml
高さを均等で配置しています。
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.test.rpggame.MainActivity"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:src="@drawable/back" /> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:src="@drawable/m0" /> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:src="@drawable/p0" /> </LinearLayout> </RelativeLayout>