user1871516
user1871516

Reputation: 1009

How to add a border on the gridview in android?

I would like to add a border surrounding the whole gridview :

I tired the xml apporach

android:background:@drawable/border

border.xml

<solid android:color="#FFF" />

<stroke
    android:width="1dp"
    android:color="#808080" />

<corners android:radius="10dp" />

The problem is when there is a lot of elements in gridview, the grid is long and it consume too much memory in texture ,

it will return error like : too large texture to write to view or the drawing cache(xxxx MB) is exceed

Are there any better way to do this? Thanks

Upvotes: 0

Views: 1078

Answers (1)

Phant&#244;maxx
Phant&#244;maxx

Reputation: 38098

Give a margin to your gridview, so that it's smaller than its container.

Then the "border" will be the container itself, showing its background color/image.

That's really all you need to have a border around your GridView.

Upvotes: 1

Related Questions