main.xml
<?xml version=”1.0″ encoding=”utf-8″?>
<TabHost xmlns:android=”http://schemas.android.com/apk/res/android”
android:id=”@+id/my_tabhost”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”>
<TabWidget
android:id=”@android:id/tabs”
android:layout_width=”fill_parent”
android:layout_height=”65px”/>
<FrameLayout
android:id=”@android:id/tabcontent”
android:layout_width=”fill_parent”
android:layout_height=”200px”
android:paddingTop=”65px”>
<LinearLayout
android:id=”@+id/content”
android:orientation=”vertical”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”>
</LinearLayout>
</FrameLayout>
</TabHost>
tabViewTest2 .java
package com.android.mytabviewtest;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
public class tabViewTest2 extends Activity {
private int ADD_NEW_TAB = Menu.FIRST;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
TabHost tabs = (TabHost) this.findViewById(R.id.my_tabhost);
tabs.setup();
TabSpec tspec1 = tabs.newTabSpec(”First Tab”);
tspec1.setIndicator(”One”);
tspec1.setContent(R.id.content);
tabs.addTab(tspec1);
TabSpec tspec2 = tabs.newTabSpec(”Second Tab”);
tspec2.setIndicator(”Two”);
tspec2.setContent(R.id.content);
tabs.addTab(tspec2);
TabSpec tspec3 = tabs.newTabSpec(”Third Tab”);
tspec3.setIndicator(”Three”);
tspec3.setContent(R.id.content);
tabs.addTab(tspec3);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(0, ADD_NEW_TAB, 0, “New Tabs”);
return true;
}
//Dynamically delete tabs, then add one again
//Problem with SDK 1.1 returns null pointer exception
@Override
public boolean onOptionsItemSelected(MenuItem item) {
TabHost tabs = (TabHost) this.findViewById(R.id.my_tabhost);
tabs.clearAllTabs();
tabs.setup();
TabSpec tspec1 = tabs.newTabSpec(”New Tab”);
tspec1.setIndicator(”NEWTAB”, this.getResources().getDrawable(R.drawable.icon));
tspec1.setContent(R.id.content);
tabs.addTab(tspec1);
return super.onOptionsItemSelected(item);
}
}

Related Posts by Categories
android
- Trik Tekken 3 Android
- Pes 2018 Psp Android Iso Download
- Epic Games Yt
- Fortnite Battle Royale For Android (apk V3.6.1)
- Fifa 18 Android Download Games
- Pubg Mobile Lite
- Pubg Mobile Zombie
- Gta Vice City Android Full Version
- Gta Vice City Android For Download
- Pubg Mobile For Windows 10
- Fortnite For Android Release Date Epic Games
- Epic Game Launcher Installer
- Pes 2018 Android Kit
- Gta Vice City Android Cleo
- Fortnite Game News
- Fortnite Game Volume Not Working
- Epic Games Username
- Fortnite Game Won't Launch
- Cara Mengembalikan Akun Pes 2018 Android Yang Hilang
- Tekken 3 Android Tablet
- Fortnite Game Microsoft
- Gta Vice City Android Org
- Pes 2018 Android With Data
- Fortnite Android Register
- Epic Game Fortnite Mobile Beta
in
- android app market | iOS 7 Theme HD Concept For Android 8 in 1 v3 Full Apk
- best android apps | How to Install Java in Galaxy Y
- best android apps | Download Brothers In Arms 2 Free v1 1 8 Mod For Android APK DATA Files Unlimited Money
- android mobile applications | Kairosoft Series in 1 Pack APK
- Install wrong ppas for Gimp in Linux Mint12
- Ask your question in the 2012 Google Science Fair
- Raising awareness for breast cancer through the Pink Pin Initiative in NYC and beyond
- Download Game Android Brothers in Arms 2 Global Front APK DATA
0 komentar:
Posting Komentar