vicenrele
vicenrele

Reputation: 971

How to put a image in top and right?

How can I put a image on top and right of the screen? With android:layout_gravity="top|right" only works right. The image is on the bottom

<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>

Upvotes: 0

Views: 1499

Answers (1)

canova
canova

Reputation: 3975

instead of android:gravity="bottom" , write android:gravity="top|right" to your outer LinearLayout

Upvotes: 2

Related Questions