1

私はmain.xmlAndroidでUIを設計するためにファイルを使用しています。最後のTextView(id:ImageDescription)が機能しない理由がわかりません。タグを削除するImageViewと、最後のタグTextViewが再び機能します。これが私のスクリーンショットです。タグがない場合の最初のインImageView、およびタグがある場合の2番目のインImageView

<code> ImageView</code>タグではありません <code> ImageView</code>タグ付き

ご覧のように、画像があると線が見えませんImage descriptor: a cartoon tiger。これが私の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>

助けてくれてありがとう:)

4

3 に答える 3

1

私の質問に対する別の回答があります。私の投稿を見て、さらに回答が必要な人にここに投稿します。私がandroid:adjustViewBounds="true"プロパティを使用すること:)

于 2012-02-23T13:10:15.743 に答える
1

imageDescription テキストビューを imageview の下に追加しています。スクロールビューには、fill_parent として with と hight の両方があります。一度これを試してください。

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

画像が大きすぎると思います。その場合layout:weightは、画像とテキスト ビューの両方に適切な割合でパラメーターを指定してみてください。

于 2012-02-22T15:22:34.353 に答える
1

XML 部分を変更してみてください

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

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

あなたはあなたの身長ScrollViewと同じくらい大きくなろうとするからです。LinearLayout

于 2012-02-22T15:32:37.793 に答える