android - ListView rows disappear when adding a RelativeLayout below a ListView -
here's simplified version of portrait ui want layout:
it's listview above layout.
the complication want whole bottom layout (in case 'button2') visible when lots of lines added edittext:
i've been trying achieve nesting relativelayout inside linearlayout. unfortunately, listview disappears when effect want edittext, e.g.
i've tried loads of alternatives, nothing seems achieve both goals.
here's xml:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" > <framelayout android:id="@+id/aaa" android:layout_width="match_parent" android:layout_height="wrap_content" > </framelayout> <linearlayout android:id="@+id/bbb" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/aaa" android:orientation="vertical" > <linearlayout android:id="@+id/list_container" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" > <listview android:id="@+id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:entries="@array/list_items"/> </linearlayout> <relativelayout android:id="@+id/input_parent" android:layout_width="match_parent" android:layout_height="wrap_content" > <button android:id="@+id/button1" android:layout_above="@+id/bottom_layout" android:layout_width="100dip" android:layout_height="50dip" android:clickable="true" android:text="button1" /> <edittext android:id="@+id/edittext" android:layout_above="@+id/bottom_layout" android:layout_torightof="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:minheight="50dip" android:imeoptions="flagnoextractui" android:inputtype="textmultiline" android:maxlines="8" android:scrollbars="vertical" /> <!-- align bottom when input text area gets big doesn't push section off screen --> <linearlayout android:id="@+id/bottom_layout" android:layout_alignparentbottom="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <button android:id="@+id/button2" android:layout_width="match_parent" android:layout_height="150dip" android:layout_gravity="bottom" android:clickable="true" android:text="button2" /> </linearlayout> </relativelayout> </linearlayout> </relativelayout>
if remove android:layout_alignparentbottom="true"
bottom_layout listview contents appears, lose effect want edittext.
can help? need support os 2.2+.
simplifying layout bit this:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main" android:layout_width="match_parent" android:layout_height="match_parent" > <framelayout android:id="@+id/aaa" android:layout_width="match_parent" android:layout_height="wrap_content" > </framelayout> <relativelayout android:id="@+id/bbb" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/aaa" android:orientation="vertical" > <listview android:id="@+id/list" android:layout_above="@+id/edittext" android:layout_width="match_parent" android:layout_height="match_parent" android:entries="@array/list_items"/> <button android:id="@+id/button1" android:layout_above="@+id/bottom_layout" android:layout_width="100dip" android:layout_height="50dip" android:clickable="true" android:text="button1" /> <edittext android:id="@+id/edittext" android:layout_above="@+id/bottom_layout" android:layout_torightof="@+id/button1" android:layout_width="match_parent" android:layout_height="wrap_content" android:minheight="50dip" android:imeoptions="flagnoextractui" android:inputtype="textmultiline" android:maxlines="8" android:scrollbars="vertical" /> <!-- align bottom when input text area gets big doesn't push section off screen --> <linearlayout android:id="@+id/bottom_layout" android:layout_alignparentbottom="true" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <button android:id="@+id/button2" android:layout_width="match_parent" android:layout_height="150dip" android:layout_gravity="bottom" android:clickable="true" android:text="button2" /> </linearlayout> </relativelayout> </relativelayout>
seems give result describing.
Comments
Post a Comment