If you want your gridview to have 2 columns, just use the stretchMode to set the width dynamically.
<GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchMode="columnWidth"
android:numColumns="2"
/>
You may want to replace android:layout_width="match_parent"
by another value if you don't want the gridview to take all the super view's width.