I would like to add space to the top and bottom of GridView, similar to header/footer but I only wanted to support spaces and nothing else.
Currently I am using top/bottom padding, but when scrolled the content will be cropped in the padding part.
What's the simplest solution for this? Thanks!
If I understand you right, it should look like this:
For that an easy solution is mentioned here by Maciej: How to add extra space inside at the bottom of a GridView
You just need to add the following in your GridView Layout:
<GridView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="50dp"
android:paddingBottom="50dp"
android:clipToPadding="false"/>
The most important part is the clipToPadding attribute which has to be set to false.
You can also see the according blog post from Google, where this solution is mentioned: https://plus.google.com/+AndroidDevelopers/posts/LpAA7q4jw9M