Android: LinearView with fixed sized widgets left and right and a flexible one in the middle -
seems simple question, can't figure out how it.
i have horizontal linearview of fixed size @ left, comes text should take mich space possible, on right should fixed-size object.
now, problems right now: when text in middle long, object @ right gets pushed out of window. when text short, not sit @ right border of window, directly next text.
how can it? code far (as can see, tried use layoutweight, didn't help...):
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:id="@+id/important" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginright="10dp" android:background="#000000" android:layout_weight="1"/> <linearlayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="1"> <textview android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingtop="5dp" android:paddingright="5dp" android:paddingleft="0dp" android:textcolor="#333333" android:paddingbottom="0dp" android:textsize="14sp" android:scrollhorizontally="true"/> <textview android:id="@+id/description" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textcolor="#666666" android:paddingtop="3dp" android:paddingright="5dp" android:paddingleft="10dp" android:paddingbottom="5dp" android:textsize="12sp" /> </linearlayout> <imageview android:id="@+id/lastpage" android:src="@drawable/lastpage" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_weight="200" android:scaletype="center" android:layout_gravity="right"/> </linearlayout>
looking @ answer android: linearview fixed sized widgets left , right , flexible 1 in middle maybe need set layout_width
of middle element 0px make not use width gained content decide via weight.
hope helps.
Comments
Post a Comment