android - add two buttons with gridview -
i trying add 2 buttons in relative
layout gridview
.
but when adding second button
not working crashing sometimes.
my desire design
:-
but adding 1 button successfully. 1 button code
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <button android:id="@+id/delete_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:text="delete selected image" /> <gridview android:id="@+id/gridview1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/delete_button" android:layout_alignparenttop="true" android:columnwidth="90dp" android:gravity="center" android:horizontalspacing="10dp" android:numcolumns="auto_fit" android:stretchmode="columnwidth" android:verticalspacing="10dp" > </gridview> </relativelayout>
and getting out put this:-
how can add second button between grid , bottom button.
<button android:id="@+id/delete_button" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:text="delete selected image" /> <gridview android:id="@+id/gridview1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/button1" android:columnwidth="90dp" android:gravity="center" android:horizontalspacing="10dp" android:numcolumns="auto_fit" android:stretchmode="columnwidth" android:verticalspacing="10dp" > </gridview> <button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/delete_button" android:layout_alignparentright="true" android:layout_marginbottom="22dp" android:text="secondbutton" /> </relativelayout>
add second button on top of first button , right
android:layout_above="@+id/delete_button" android:layout_alignparentright="true"
Comments
Post a Comment