Pregunta

estoy usando el archivo main.xml para diseñar UI en Android.no se porque el ultimo TextView (identificación:ImageDescription) no funciona.si elimino ImageView etiqueta, la ultima TextView funcionará de nuevo.Aquí está mi captura de pantalla.el primero en cuando no ImageView etiqueta, y el segundo cuando tiene ImageView

not <code>ImageView</code> tag with <code>ImageView</code> tag

Como ves, cuando tengo imagen, no puedo ver la línea. Image descriptor: a cartoon tiger.Aquí está mi main.xml:

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

    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/imageTitle"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/test_image_title"/>

     <TextView 
        android:id="@+id/imageDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/test_image_date"/>


     <ImageView
         android:id="@+id/imageDisplay"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:contentDescription="@string/test_contentDescription"
         android:src="@drawable/test_image"/>

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TextView 
            android:id="@+id/imageDescription"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/test_image_description"/>
    </ScrollView>         

</LinearLayout>

gracias por ayudarme :)

¿Fue útil?

Solución

Está agregando su vista de texto imageDescription debajo de imageview y eso también su vista de desplazamiento tiene tanto con como alto fill_parent, una vez que pruebe esto

 <TextView 
        android:id="@+id/imageDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/test_image_date"/>


    <ScrollView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <TextView 
            android:id="@+id/imageDescription"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/test_image_description"/>
    </ScrollView> 

     <ImageView
         android:id="@+id/imageDisplay"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:contentDescription="@string/test_contentDescription"
         android:src="@drawable/test_image"/>

Creo que la imagen es demasiado grande, si es el caso prueba especificando layout:weight parámetro para la vista de imagen y texto en el porcentaje adecuado.

Otros consejos

Intenta cambiar tu parte XML

<ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

a

<ScrollView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

porque su ScrollView trata de ser tan grande como tu LinearLayout En Altura.

Tengo otra respuesta para mi pregunta, publico aquí para quienes vieron mi publicación y necesitan más respuestas.que yo uso android:adjustViewBounds="true" Propiedad :)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top