问题描述:

I have LinearLayout and I want to put into it ImageView. Is there any simple way how to put this image on the right side of the screen? Now, the image is placed to the left, padding and marking don't solve this, because this should be done dynamically, the image is each time different.

Thanks.

网友答案:

Have you tried setting the gravity attribute to right?

<ImageView
    android:id="@+id/image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:contentDescription="@string/imageDesc"
    android:src="@drawable/image" />
相关阅读:
Top