Saturday, 22 August 2015

Types Of Layouts In Android 2

Grid View:

Android GridView shows items in two-dimensional scrolling grid (rows & columns) and the grid items are not necessarily predetermined but they automatically inserted to the layout using a ListAdapter.



OR



Following is the xml code for Grid view. 


<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/gridview"
   android:layout_width="fill_parent" 
   android:layout_height="fill_parent"
   android:columnWidth="90dp"
   android:numColumns="auto_fit"
   android:verticalSpacing="10dp"
   android:horizontalSpacing="10dp"
   android:stretchMode="columnWidth"
   android:gravity="center"
/>


List View:

This Android ListView tutorial covers listview concepts in details with sample app examples. Once you have some confidence with Android Listview, you can then proceed to attempt App Tutorial by clicking "Learn to build a Twitter App" button on the right.
Android ListView is a view group that displays a list of scrollable items. If you have a date which is repeated in the form of a collection or list, the listview is the best User Interface element to use. ListView helps you in displaying repeating data in the form of a scrollable list. Users can then select any listitem by clicking on it.
ListView is widely used in Android Applications. A simple example of ListView is your contact book, where you have a list of your contacts displayed in a ListView.

<ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
    </ListView>


List View


Tab Layout:

Tab Layout can we used to add tabs in the activity as show in the below figure.




     


Tab layout can be achieved by using ViewPager or Fragments.

We will see in details in coming tutorial about ViewPager and Fragments.

Please Send Your Comments To ambilpura.sunil@gmail.com


NEXT Tutorial:  Android Interview Questions For Freshers and Exp.



No comments:

Post a Comment