Friday, 23 August 2013

Set GridView selector default

Set GridView selector default

Within my Android app currently, I have a GridView that uses a custom
adapter to populate it with multiple custom views.

This GridView is defined as follows:
<GridView
android:id="@+id/grid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="false"
android:isScrollContainer="false"
android:listSelector="@drawable/selector"
android:numColumns="3"
android:stretchMode="columnWidth" />
As you can see, I have defined a custom 'List Selector' that allows users
to see what item of the grid view they have selected.

What I want to know is the following, Is it possible that when the grid
view is populated using the custom adapter the List Selector can be set to
a default value? (Currently the list selector only appears once a user has
made a choice - obviously).

The custom GridView adapter is a simple adapter that extends BaseAdapter.
Many thanks

No comments:

Post a Comment