ブログとかSNSを継続利用するのが大嫌いな僕がまさかの第2回
酔ってるので、細かいことは気にしないでください
はい、xmlです。
何か初見のgravityとか言う奴が出てきましたね。
重力かよ!?
引っ張ると自分が面倒なので進めると
「子要素の位置を自身の範囲内で指定できます。」
ニホンゴめんどくせー
要はleftって指定したら自分の表示範囲内で左に
rightって指定したら自身の範囲内で右に
詰めて表示します。
実際の表示
left指定(指定なしと同じやん)
right指定
はい、ここでダルいポイントが出てきます。
左右はleft,rightでいいのが分かった
上下はtop,bottomで良さそうな気がする
じゃあ右下は?
面倒なのでxmlです。
順番無視でbottom|right的に"|"区切りで指定すればいいです。
表示は以下





酔ってるので、細かいことは気にしないでください
はい、xmlです。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:gravity="left">
<Button android:text="TEST1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button android:text="TEST2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button android:text="TEST3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>何か初見のgravityとか言う奴が出てきましたね。
重力かよ!?
引っ張ると自分が面倒なので進めると
「子要素の位置を自身の範囲内で指定できます。」
ニホンゴめんどくせー
要はleftって指定したら自分の表示範囲内で左に
rightって指定したら自身の範囲内で右に
詰めて表示します。
実際の表示
left指定(指定なしと同じやん)
right指定
はい、ここでダルいポイントが出てきます。
左右はleft,rightでいいのが分かった
上下はtop,bottomで良さそうな気がする
じゃあ右下は?
面倒なのでxmlです。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:gravity="right|bottom">
<Button android:text="TEST1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button android:text="TEST2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button android:text="TEST3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
順番無視でbottom|right的に"|"区切りで指定すればいいです。
表示は以下


