ImageView agrega espacios en blanco alrededor de mi imagen

I have an ImageView that when I look at in the XML preview layout on Eclipse looks fine, but when I launch the app on my hardware device a big espacio en blanco comes to surround it. This is what the actual imagen is, without the whitespace that is being added. Here is my Archivo XML too. How do I get rid of this whitespace?

preguntado el 24 de agosto de 12 a las 02:08

Will that image ever be larger than the screen itself? As in, is the image dynamic, with different sizes (one of which may need to shrink down)? -

Well the image was 566x177 so not sure if thats bigger than my Galaxy s3 screen -

1 Respuestas

Since your image shouldn't be too large, try this:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/linkMe"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:contentDescription="cat"
        android:src="@drawable/ashsc" />

</LinearLayout>

This way, the image won't attempt to scale and won't create bounds outside the ImageViewla imagen de

Respondido 24 ago 12, 03:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.