「Android/レイアウト/Layoutなどの使い方」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==水平一直線== <<nowiki />LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizon...」) |
|||
| 行1: | 行1: | ||
| + | ==レイアウト種類== | ||
| + | *LinearLayout ・・レイアウトを横に並べる | ||
| + | *FrameLayout ・・レイアウトを重ねる | ||
| + | *RelativeLayout ・・上の2つの組み合わせを同時にできる | ||
| + | |||
==水平一直線== | ==水平一直線== | ||
<<nowiki />LinearLayout | <<nowiki />LinearLayout | ||
2018年12月10日 (月) 10:34時点における版
レイアウト種類
- LinearLayout ・・レイアウトを横に並べる
- FrameLayout ・・レイアウトを重ねる
- RelativeLayout ・・上の2つの組み合わせを同時にできる
水平一直線
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
垂直一直線
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
絶対位置を指定
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center_horizontal"
Linearでの配置
android:gravity="right" android:gravity=”bottom”
top コンテナの上部に配置 bottom コンテナの下部に配置 right コンテナの左側に配置 left コンテナの右側に配置 fill オブジェクトの高さ・幅を、コンテナのサイズに合わせる。 fill_vertical オブジェクトの高さをコンテナのサイズに合わせる。 fill_horizontal オブジェクトの幅をコンテナのサイズに合わせる。 center オブジェクトを中央に配置する。サイズ変更無し。 center_vertical オブジェクトを上下中央に配置しする。サイズ変更無し。 center_horizontal オブジェクトを左右中央に配置する。サイズ変更無し。 clip_vertical top/bottomの追加オプションとして、オブジェクトの上部/下部の境界をコンテナの境界に合わせます。 clip_horizontal left/rightの追加オプションとして、オブジェクトの左側/右側の境界をコンテナの境界に合わせます。
