Here is my code in my Activity:
public class GridViewActivity extends Activity {
GridView gridView;
static final String[] MOBILE_OS = new String[]
Use the android:numColumns="2"
in your GridView widget
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/grid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:numColumns="2"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:scrollbarStyle="outsideOverlay"
android:verticalScrollbarPosition="right"
android:scrollbars="vertical">
</GridView>
You can get familiar with Android UI in this link.Try to focus on the GridView Topic
you can also set number of columns by programmatically in a GridView in following way:-
gridview.setNumColumns(n);
where 'n' is the number of columns.