Ammu
Ammu

Reputation: 97

Android customize first child of grid view

I want a grid view in which first child alone should be there in first row with different layout design and remaining childs can be similar in their designs. How can I achieve this? Please refer to the screen shot to get the idea.

enter image description here

Upvotes: 0

Views: 1960

Answers (2)

Marko Petrovic
Marko Petrovic

Reputation: 11

There is one nasty way to do it. Add an empty entry to the list at position 1 And then in getView:

if position is 0 set layout width of that item to be 2x normal width.

if position is 1 (or make some kind of flag for that item) inflate empty layout like

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="200dip"
    android:visibility="gone" />

Upvotes: 1

Dororo
Dororo

Reputation: 3440

This isn't really possible but it is possible to fake it. The trick is to split the bitmap in half and show each half as separate images. See Bigger image for first item of the gridview android for more information.

Upvotes: 0

Related Questions