Hello,
You can display Title and GridView items separately.
For example, You can add a Girdlayout( display the Title) above your gridview like following layout. And add button to your tablebirthdate
layout.
Because listview have a reuse layout issue, So I recommend you add a Girdlayout( display the Title) above your gridview.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:orientation="horizontal"
android:id="@+id/gridLayout1"
android:columnCount="5"
android:background="#ff71216c"
>
<TextView
android:text="Day remain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:fontFamily="calibri"
android:textColor="#ffffffff"
android:layout_columnWeight= "1"
/>
<TextView
android:text="Birthdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:fontFamily="calibri"
android:textColor="#ffffffff"
android:layout_columnWeight= "1"
/>
<TextView
android:text="Surname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:fontFamily="calibri"
android:textColor="#ffffffff"
android:layout_columnWeight= "1"
/>
<TextView
android:text="Name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:fontFamily="calibri"
android:textColor="#ffffffff"
android:layout_columnWeight= "1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hide"
android:layout_columnWeight= "1"
android:visibility="invisible"/>
</GridLayout>
<GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
Then you can move the SetBackgroundResource from adapter to the OnCreate method.
GridLayout gridLayout1 = FindViewById<GridLayout>(Resource.Id.gridLayout1);
gridLayout1.SetBackgroundResource(Resource.Drawable.itemstat);
Next, you can add button in your tablebirthdate.xml
.
<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation= "horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff71216c"
android:columnCount="5"
>
<TextView
android:id="@+id/tableremain"
android:text="test1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:fontFamily="calibri"
android:textColor="#ffffffff"
android:layout_columnWeight= "1"
/>
<TextView
android:text="test1"
android:id="@+id/tabledatebirth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:fontFamily="calibri"
android:textColor="#ffffffff"
android:layout_columnWeight= "1"
/>
<TextView
android:text="test1"
android:id="@+id/tablesurname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:fontFamily="calibri"
android:textColor="#ffffffff"
android:layout_columnWeight= "1"
/>
<TextView
android:text="test1"
android:id="@+id/tablenamebirth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:fontFamily="calibri"
android:textColor="#ffffffff"
android:layout_columnWeight= "1"
/>
<Button
android:id="@+id/button1"
android:text="add"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_columnWeight= "1"/>
</GridLayout>
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.