LoginSignup
2
2

More than 5 years have passed since last update.

Androidのxmlで右下に配置する方法

Posted at

Androidのマテリアルデザインでは右下に丸いボタンが配置されることが多いのですが、これをxmlで書く場合はどのようにすればいいのか少し手間取ったのでメモ

FrameLayout
├-メインのビュー
└-RelativeLayout-ボタン

このように、FrameLayoutでメインのビューの上にレイヤーのようにしてRelativeLayoutを乗せます。

ボタンは

android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"

とすることで右下に配置することが出来ます。
これだとぴったし右下に配置されるので、マージンを設定するといい感じに配置出来るかと思います。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2