android - Ordering elements in a layout file -
i have been trying layout elements such button occupies bottom of screen , remaining elements arranged in successive manner @ top of screen no success. last editext(opedt) showed bit distant others somewhere in middle of screen. changes have them in desired order? here xml layout file:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:background="@drawable/beezlinkbackg" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context="gsie.beezlink.opportunityactivity"> <relativelayout android:id="@+id/footer" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:gravity="center" > <button android:layout_width= "match_parent" android:layout_height="wrap_content" android:text="@string/posterbtn" android:background="#008000" android:id="@+id/posterbtn" /> </relativelayout> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/cinteretxt" android:textsize="20sp" android:textstyle="bold" android:id="@+id/cinteretxt" android:layout_alignparenttop="true" /> <spinner android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cinteretspin" android:layout_below="@+id/cinteretxt" android:layout_alignparentleft="true" android:layout_alignparentstart="true" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/optitretxt" android:textsize="20sp" android:textstyle="bold" android:id="@+id/optitretxt" android:layout_below="@+id/cinteretspin" /> <edittext android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/optitreedt" android:layout_below="@+id/optitretxt" android:hint="@string/hintoptitre" android:layout_alignparentleft="true" android:layout_alignparentstart="true" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/optxt" android:textsize="20sp" android:textstyle="bold" android:id="@+id/optxt" android:layout_below="@+id/optitreedt" /> <edittext android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/opedt" android:hint="@string/hintpost" android:layout_below="@+id/optxt" android:layout_above="@+id/footer" android:layout_alignparentleft="true" android:layout_alignparentstart="true" /> </relativelayout>
edit: looks have awarded points without testing. when type long text in last edittext(opedt),it overlaps button @ bottom. text gets on top of button. want text stop before reaching button , scrolls.
remove relativelayout-wrapper button , add following attribute button: android:layout_alignparentbottom="true"
Comments
Post a Comment