android - How do I prevent TextView from stretching out it's parent LinearLayout? -


it seems textview inside linearlayout forces linearlayout larger. trying split screen top 50% , bottom 50% , bottom 50% split 3 parts. did weights 3 (for top), , 1, 1, 1 (for bottom) total of 6.

here looks like. http://i.imgur.com/3fjsw.jpg

as take out textview inside first linearlayout splits proper. moment put textview inside top linearlayout top linerlayout gets larger amount of the textview.

here code:

<?xml version="1.0" encoding="utf-8"?>     <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="fill_parent"     android:layout_height="fill_parent">   <linearlayout      android:layout_width="fill_parent"       android:layout_height="wrap_content"      android:orientation="horizontal"      android:background="#cccccc"      android:layout_weight="3">       <textview        android:text="@string/hello"          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:textcolor="#000000"          android:layout_weight="1"/>  </linearlayout>       <linearlayout      android:layout_width="fill_parent"       android:layout_height="wrap_content"      android:orientation="horizontal"      android:background="#aa0000"      android:layout_weight="1">  </linearlayout>        <linearlayout      android:layout_width="fill_parent"       android:layout_height="wrap_content"      android:orientation="horizontal"      android:background="#00aa00"      android:layout_weight="1">  </linearlayout>        <linearlayout      android:layout_width="fill_parent"       android:layout_height="wrap_content"      android:orientation="horizontal"      android:background="#0000cc"      android:layout_weight="1">  </linearlayout></linearlayout> 

try changing layout textview from:

 <linearlayout      android:layout_width="fill_parent"       android:layout_height="wrap_content"      android:orientation="horizontal"      android:background="#cccccc"      android:layout_weight="3"> 

to:

<linearlayout      android:layout_width="fill_parent"       android:layout_height="fill_parent"      android:orientation="horizontal"      android:background="#cccccc"      android:layout_weight="1"> 

if doesnt work, maybe take away "orientation" well.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -