In this article we are going to see how you can create a simple Android Layout that includes a header part, a footer part and the content area.
Then for main content area we have put another linear layout with sttribute
1. Create a new Android Project
We have to specify the Application Name, the Company Name and the Package name in the appropriate text fields and then click Next.
In this step,specify different factors our app will run,in our case we will use Phone and Tablets.
In this step select Empty activity and press Next.
In this step specify name of the activity class and layout file and click on finish.
2.Change the layout of the Main Activity
Open app/ file : and paste the following code
filename :activity_main.xml
The idea is very simple first,we have put relative layout as a root layout ,
then as a header view we have put linear layout with attribute android:layout_alignParentTop=true
then as a header view we have put linear layout with attribute android:layout_alignParentTop=true
and with id android:id=@+id/header.
Then for main content area we have put another linear layout with sttribute
android:layout_below=@+id/header and with attribute android:layout_above=@+id/footer.
You can also use Scrollview instead of linear layout for more flexible scrolling content.
For footer view we have put another linear layout with attribute
For footer view we have put another linear layout with attribute