当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Aligning image in LinearLayout

问题描述:

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" />
分享给朋友:
您可能感兴趣的文章:
随机阅读: