android - ImageView appears in the wrong place in LinearLayout -
i'm following tutorial head first android development , can't figure out why linearlayout not working should.
here xml code:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" tools:context=".mainactivity" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:id="@+id/imagetitle" android:layout_width="wrap_content" 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:src="@drawable/test_image"/> <textview android:id="@+id/imagedescription" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/test_image_description"/> </linearlayout>
the problem image goes in middle, image should under 2 lines of text displayed on upper side, not in middle. last textview isn't shown @ all. should show in order declared in xml.
aleast that's tutorial showed.
i tried putting imageview part on top of textviews , no text @ , image still in middle.
now has behavior changes since book released or missing something?
i found answer from: imageview in android xml layout layout_height="wrap_content" has padding top & bottom
you need add imageview:
android:adjustviewbounds="true"
for reason wrap_content not work height without line.
Comments
Post a Comment