In this example we have three tab as follows. you can move in the any tab at by clicking on the Tab. as follows
- First we design the XML layout as follows
<?xml version="1.0" encoding="utf-8"?> <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TabWidget android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@android:id/tabs"></TabWidget> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@android:id/tabcontent"> </FrameLayout> </LinearLayout> </TabHost>
- Create the Activtity file for diffrent Tab Activities we have create three diffrent Activity : ActivityA, ActivityB, ActivityC as follows
- Than we Create Our main Activity as follows code..
package com.container; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class ActivityA extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv=new TextView(this); tv.setText("I am in Tab A.."); setContentView(tv); // TODO Auto-generated method stub } }
package com.container; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class ActivityB extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv=new TextView(this); tv.setText("I am in Tab B.."); setContentView(tv); // TODO Auto-generated method stub } }
package com.container; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class ActivityC extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv=new TextView(this); tv.setText("I am in Tab C.."); setContentView(tv); // TODO Auto-generated method stub } }
package com.container; import android.app.TabActivity; import android.content.Intent; import android.content.res.Resources; import android.os.Bundle; import android.widget.TabHost; public class TabViewDemoActivity extends TabActivity { /** Called when the activity is first created. */ Resources res; TabHost tabHost; TabHost.TabSpec spec; Intent intent; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); res=getResources(); tabHost=getTabHost(); /**Create Tab A**/ intent=new Intent().setClass(this,ActivityA.class); spec=tabHost.newTabSpec("A") .setIndicator("A",res.getDrawable(R.drawable.ic_btn_speak_now)) .setContent(intent); tabHost.addTab(spec); /**Create Tab B**/ intent=new Intent().setClass(this,ActivityB.class); spec=tabHost.newTabSpec("B") .setIndicator("B",res.getDrawable(R.drawable.ic_btn_speak_now)) .setContent(intent); tabHost.addTab(spec); /**Create Tab C**/ intent=new Intent().setClass(this,ActivityC.class); spec=tabHost.newTabSpec("C") .setIndicator("C",res.getDrawable(R.drawable.ic_btn_speak_now)) .setContent(intent); tabHost.addTab(spec); } }
yurtdışı kargo
ReplyDeleteresimli magnet
instagram takipçi satın al
yurtdışı kargo
sms onay
dijital kartvizit
dijital kartvizit
https://nobetci-eczane.org/
7XXH
Eskişehir
ReplyDeleteAdana
Sivas
Kayseri
Samsun
XG0DOP
sakarya
ReplyDeleteyalova
elazığ
van
kilis
ZWNA8
8012E
ReplyDeleteManisa Şehirler Arası Nakliyat
Kilis Parça Eşya Taşıma
Yenimahalle Parke Ustası
Çankırı Evden Eve Nakliyat
Ağrı Lojistik
Kırşehir Şehir İçi Nakliyat
Kastamonu Evden Eve Nakliyat
Apenft Coin Hangi Borsada
Çankırı Lojistik
D8DAB
ReplyDeletereferans kodu binance
03AEC
ReplyDeleteçorum mobil sohbet
mobil sohbet et
ağrı sesli sohbet sesli chat
Ankara Telefonda Sohbet
görüntülü sohbet yabancı
Tunceli Telefonda Görüntülü Sohbet
denizli sohbet muhabbet
bedava sohbet siteleri
istanbul canlı sohbet odası
B15E296E8F
ReplyDeleteinstagram kadın takipçi