android layout_weight squeezing an view too thin -
i can't seem figure out how use android's layout_weight attribute. i'm trying create custom listview has 3 textview's. primary textview resides @ top left, have text view resides in top right for, , third 1 lives underneath primary textview. i'd primary , top right 2 on horizontal axis want primary textview take 70% of width, while other textview takes remaining 30%. no matter weight assign primary , right textview, primary textview larger , squeezes right data textview wayyy thin.
my code:
<linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="5dip" android:id="@+id/llayout"> <!-- title--> <textview android:id="@+id/primarytitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="loading tadglkj dgjg sadlgkj dgksgj sgj sdgk" android:textcolor="#040404" android:typeface="sans" android:textsize="18dip" android:textstyle="bold" android:paddingtop="0dp" android:background="#888" android:layout_weight="4"/> <!-- right data --> <textview android:id="@+id/rightdata" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="10" android:layout_marginright="5dip" android:textsize="12dip" android:textcolor="#b53021" android:textstyle="bold" android:background="#bada55" android:text="1.3 mi"/> </linearlayout> <!-- secondary title --> <textview android:id="@+id/secondarytitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textcolor="#343434" android:textsize="12dip" android:layout_margintop="1dip" android:text="hello other data"/>
on item want 70% set layout_weight="30"
, on item want 30% set layout_weight="70"
. should solve problem.
Comments
Post a Comment