Friday, 15 May 2015

android - How to make a grid of buttons with good proportions -



android - How to make a grid of buttons with good proportions -

i need create grid 4 square (or rectangle) same proportions

the 4 squares must have same size, , take space the margin must same everywhere there these 4 squares

i did gridview can't manage margins easily. how can acheive ?

here gridview :

android:id="@+id/activity_home_grid" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/activity_home_search" android:layout_marginbottom="@dimen/margin_large" android:layout_marginleft="@dimen/margin_large" android:layout_marginright="@dimen/margin_large" android:background="@android:color/transparent" android:gravity="center" android:horizontalspacing="@dimen/margin_large" android:numcolumns="2" android:overscrollmode="never" android:scrollbars="none" android:stretchmode="columnwidth" android:verticalspacing="@dimen/margin_large"

here cells

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/selector_blue" > <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:orientation="vertical" > <imageview android:id="@+id/cell_grid_allzic_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginbottom="@dimen/margin_medium" > </imageview> <textview android:id="@+id/cell_grid_allzic_label" style="@android:style/textappearance.medium" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleline="true" android:textcolor="@android:color/white" /> </linearlayout> </relativelayout>

android android-gridview

No comments:

Post a Comment