I'm using file main.xml
to design UI in Android. I don't know why the last TextView
(id: ImageDescription) doesn't work. If I delete ImageView
tag, the last TextView
will work again.
Here is my screenshot. the first in when no ImageView
tag, and the second when has ImageView
As you see, when has image, I cannot see line Image descriptor: a cartoon tiger
.
Here is my 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>
thanks for help me :)
You are adding your imageDescription textview below imageview and that too your scrollview has both with and hight as fill_parent, once try this
<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"/>
I think image is too big, if it's the case try by specifying layout:weight
parameter for both image and text view in proper percentage.