Androidで画像をどのように右寄せにするか
Androidでは、次のように画像を右寄せします。
- ImageView
- android:layout_gravity=”right”
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/your_image"
android:layout_gravity="right"/>
- ネイティブアプリでRelativeLayout
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/your_image"
android:layout_alignParentRight="true"/>
- 制約レイアウト
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/your_image"
app:layout_constraintRight_toRightOf="parent"/>
右寄せにする方法については一通り記載していますが、実際の使用用途に合わせてレイアウトや調整を加えてください。