java - Linear Layout Wrapping TextView -
i designing layout following
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" > <textview android:id="@+id/messagetext" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="some long text asd asd asd asd asd asd asd asd asd asd asd![enter image description here][1]" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="12:45 pm" /> </linearlayout>
it gives ui above...
which perfect need. long text getting wrapped without pushing button away screen orientation horizontal. button not stretching.
but if text small. looks
what want button should aligned left end of text this
i know put layout weight 1.
it consumes whole area left after giving needed space button.
if don't put that. , make width wrap content. works great short text. text grows.
it pushes button away screen.
thats problem. hope made problem enough descriptive. of course long read. painful of course. glad know pointer.
i not reluctant use relative layout well.
any appreciated.
thanks
hope works you. please try this:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <textview android:id="@+id/messagetext" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="some long text asd asd asd asd asd asd asd asd asd asd asd![enter image description here][1]" /> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="12:45 pm" />
i think need change android:layout_width="fill_parent" of linearlayout android:layout_width="wrap_content"
Comments
Post a Comment