开发者

android linear layout solution

what i'm trying to achieve is #1 but what i get is #2

http://s48.radikal.ru/i120/1005/ff/6e439e04bbc8.jpg

it seems linear layout stacks with height of it's first element and shrinks second's element height to that.

开发者_Go百科the xml for those is the following:

<?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="wrap_content"
   android:orientation="horizontal"
   android:background="#FFFFEE"
>
 <ImageView 
  android:id="@+id/thumb"
  android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:src="@drawable/example" 
    android:layout_weight="5"
 />
 <TextView
  android:id="@+id/text" 
  android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="2" 
    android:text="Aaa aaaaa aaa aaaaa, aaaaaaa aaa aaa a, aaa aa aaaaaaa aaa aa. Aaa aaaaa aaa aaaaa, aaaaaaa aaa aaa a, aaa aa aaaaaaa aaa aa. Aaa aaaaa aaa aaaaa, aaaaaaa aaa aaa a, aaa aa aaaaaaa aaa aa. Aaa aaaaa aaa aaaaa, aaaaaaa aaa aaa a, aaa aa aaaaaaa aaa aa. Aaa aaaaa aaa aaaaa, aaaaaaa aaa aaa a, aaa aa aaaaaaa aaa aa. Aaa aaaaa aaa aaaaa, aaaaaaa aaa aaa a, aaa aa aaaaaaa aaa aa."
 />
</LinearLayout>


Your XML is incomplete and would help your question, but the obvious thing to try seems to be to include

layout_height="fill_parent"

in the attributes of the second element

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜