Saturday 15 September 2012

xml - In Android App, How to arrange "a block of two vertical TextViews" and "one ImageView" with android:layout_weight -



xml - In Android App, How to arrange "a block of two vertical TextViews" and "one ImageView" with android:layout_weight -

i developing android app.

in xml, arrange "a block of 2 vertical textviews" , "one imageview" android:layout_weight, , value of former 2 , 1 of latter 1.

my code following. doesn't work.(forced termination)

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="100dp" android:minheight="100dp" android:weightsum="3" > <linearlayout android:id="@+id/article" android:layout_width="0dp" android:layout_height="100dp" android:layout_weight="2" android:orientation="vertical" > <textview android:id="@+id/articletitle" android:choicemode="singlechoice" android:layout_height="20dp" android:minheight="20dp" /> <textview android:id="@+id/articleabstract" android:choicemode="singlechoice" android:layout_height="80dp" android:minheight="80dp" /> </linearlayout> <imageview android:id="@+id/image" android:layout_width="0dp" android:layout_height="100dp" android:minheight="100dp" android:layout_weight="1" /> </linearlayout>

could tell me how solve problem?

your textviews have no width. required attribute.

<textview android:id="@+id/articletitle" android:choicemode="singlechoice" android:layout_height="20dp" android:layout_width="match_parent" android:minheight="20dp" /> <textview android:id="@+id/articleabstract" android:choicemode="singlechoice" android:layout_height="80dp" android:layout_width="match_parent" android:minheight="80dp" />

android xml android-layout-weight

No comments:

Post a Comment