Skip to main content

Posts

Showing posts from March, 2012

Tab Layout in android

Tab Layout in android/Tab activity in android Using tab layout, we can wrap multiple views in a single window and navigate through these views using tabs. Tab host, Tab widget and a frame layout are the important components used in the tab layout. In this project, we are creating three tabs named Artist, Album and Songs, and while clicking on each of these tabs, different page (means activity) will be loaded. First create a new project and add a tab host to your xml like this <TabHost xmlns:android = "http://schemas.android.com/apk/res/android"     android:id = "@android:id/tabhost"     android:layout_width = "fill_parent"     android:layout_height = "fill_parent" >     <LinearLayout         android:orientation = "vertical"         android:layout_width = "fill_parent"         android:layout_height = "fill_parent"         android:padding = "5dp" >   ...

Custom Grid View in Android/Grid View with icons and text/GridView example in android

Custom Grid View in android /Grid View with icons and text/GridView example in android Here, I am going to develop an application that displays icon with text as grid view.   In previous example, I showed you to create grid view with icons. In that case, only one xml is used to display the images. In case of custom grid view, you need to create two xml one for gridview and other for icon and text. After that we can inflate these two xml on your activity to create custom grid view CustomGridViewActivity.java package com.example; import java.util.ArrayList; import android.app.Activity; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; public class CustomGridViewActivity extends Activity {     private ArrayList<String> textfield ;  ...