Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android gridview and custom header

I'm struggeling implementing the following GUI:

enter image description here

For the 9 elements below the redline (everything under the line should be scrollable) I used a gridview layout which is working as intented. But actually I have no Idea how I make the Header.

My xml so far:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:paddingBottom="@dimen/activity_vertical_margin"
   android:paddingLeft="@dimen/activity_horizontal_margin"
   android:paddingRight="@dimen/activity_horizontal_margin"
   android:paddingTop="@dimen/activity_vertical_margin"
   android:background = "@drawable/t"
   tools:context=".AppStarter" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center">
    <GridView 
        android:id="@+id/gridview"
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:numColumns="3"
        android:verticalSpacing="10dp"
        android:horizontalSpacing="10dp"
        android:stretchMode="columnWidth"
        android:gravity="center"
        android:layout_marginLeft="2sp"
        android:layout_marginRight="5sp"
        android:layout_marginTop="0sp" />
 </LinearLayout>
</RelativeLayout>

My Idea was to add an additional linearLayout over the gridview, but the this approach didn't deliver the expected results. Any Ideas how I could implement this header?

Thanks in advance!

like image 644
Hellekin Avatar asked Mar 04 '26 09:03

Hellekin


1 Answers

You can try my own implementation. After many tries I decided write my own code!

https://github.com/munix/GridViewHeader

like image 180
Munix Avatar answered Mar 05 '26 22:03

Munix