Reputation: 956
like the title said it there are some "space" before and after an image and i don't want it.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/fond"
>
<ImageView
android:id="@+id/imageView1"
android:contentDescription="@string/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/top"
android:layout_gravity="top"
/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/fond1"
>
</LinearLayout>
</LinearLayout>
So like you can see i have a first Layout with a background. The ImageView is just after and should be on the top but it didn't. The second Layout is to much after the image. ->
first layout
--unwanted space--
image
--unwanted space--
second layout
If anyone know how to delete this "space", thanks.
Upvotes: 0
Views: 378
Reputation: 4341
Use android:adjustViewBounds="true"
inside your ImageView
. That way your ImageView
will be adjusted to the provided image bounds.
Upvotes: 2
Reputation: 4400
Use Relative layout this Way::
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/fond"
>
<ImageView
android:id="@+id/imageView1"
android:contentDescription="@string/desc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/top"
android:layout_gravity="top"
android:layout_alignParentTop="true"
/>
<LinearLayout
android:layout_below="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/fond1"
>
</LinearLayout>
</RelativeLayout>
Upvotes: 0