如何在屏幕的顶部和右侧放置图像? With android:layout_gravity="top|right"
仅适用right
。图像位于底部
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:background="@drawable/image"
android:layout_height="match_parent"
android:orientation="vertical" android:gravity="bottom">
<ImageView
android:id="@+id/imageView1" android:layout_gravity="top|right"
android:layout_width="100dp"
android:layout_height="100dp"
android:src="@drawable/logo" />
</LinearLayout>
答案 0 :(得分:2)
而不是android:gravity="bottom"
,将android:gravity="top|right"
写入外部LinearLayout