android - Add a textview for header and footer -


i've pretty noob issue linearlayouts , gridview. want display activity , header, gridview scrolls , footer. search how stuff i'm stuck footer appearing. i've xml activity layout:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="fill_parent"     android:layout_height="fill_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"     tools:context=".myactivity"     android:orientation="vertical" >     <textview         android:id="@+id/header_text"         android:text="header!"         android:gravity="center"         android:textsize="15dp"         android:layout_width="fill_parent"         android:layout_height="wrap_content"          />     <gridview         android:id="@+id/my_grid"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_centerhorizontal="true"         android:gravity="center"         android:horizontalspacing="10dip"         android:numcolumns="2"         android:stretchmode="columnwidth"         android:verticalspacing="5dip" >     </gridview>        <textview         android:id="@+id/footer_text"         android:text="footer!"         android:textsize="15dp"         android:layout_width="fill_parent"         android:layout_height="wrap_content"          /> </linearlayout> 

but layout header appears. i'm wrong? in advance.

your problem height of gridview set wrap_content. means if have more content, gridview continue expand downwards, pushing footer off screen. instead, set height of gridview 0dp , set android:layout_weight 1.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -