0

Possible Duplicate:
Android: GridView width not wrapping to content?

I am trying to display a GridView in a Dialog. Despite all my efforts, the GridView width grows to the entire screen, instead of wrapping to the columns. The layout and an image depicting the issue are below (I set a background color for the GridView to illustrate the issue).

<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/colorgridview"
    android:background="#FF00CCBB"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    android:numColumns="4"
    android:verticalSpacing="5dp"
    android:horizontalSpacing="5dp"
    android:columnWidth="70dp"
    android:stretchMode="none"
/>

enter image description here

Community
  • 1
  • 1
ab11
  • 19,770
  • 42
  • 120
  • 207

0 Answers0