Question

J'utilise le fichier main.xml Pour concevoir l'interface utilisateur dans Android. Je ne sais pas pourquoi le dernier TextView (ID: ImageDescription) ne fonctionne pas. Si je supprime ImageView Tag, le dernier TextView fonctionnera à nouveau. Voici ma capture d'écran. le premier dans quand non ImageView Tag, et le second quand a ImageView

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

Comme vous le voyez, quand a l'image, je ne vois pas la ligne Image descriptor: a cartoon tiger. Voici mon 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>

Merci de m'aider :)

Était-ce utile?

La solution

Vous ajoutez votre ImageDescription TextView ci-dessous ImageView et que aussi votre ScrollView a à la fois et à Hight As Fill_parent, essayez une fois ceci

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

Je pense que l'image est trop grande, si c'est le cas, essayez en spécifiant layout:weight Paramètre pour la vue d'image et de texte en pourcentage approprié.

Autres conseils

Essayez de changer votre pièce XML

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

à

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

parce que votre ScrollView essaie d'être aussi grand que votre LinearLayout En hauteur.

J'ai une autre réponse pour ma question, je poste ici à qui j'ai vu mon message et j'ai besoin de plus de réponses. Que j'utilise android:adjustViewBounds="true" Propriété :)

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top