Permalink
Browse files

simple tabs

  • Loading branch information...
1 parent a1b8434 commit 1de2f3399c6cda105891de00c1b377b60fae1f12 @nitindhar7 committed Jan 31, 2012
View
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
View
@@ -4,14 +4,15 @@
android:versionCode="1"
android:versionName="1.0" >
- <uses-sdk android:minSdkVersion="3" />
+ <uses-sdk android:minSdkVersion="7" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:label="@string/app_name"
- android:name=".TutorialTabsActivity" >
+ android:name=".TabTutorialActivity"
+ android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
View
No changes.
View
Binary file not shown.
View
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Binary file not shown.
@@ -15,13 +15,14 @@
}
public static final class id {
public static final int tab=0x7f050000;
- public static final int tab_image=0x7f050001;
- public static final int tab_label=0x7f050002;
+ public static final int tabDivider=0x7f050003;
+ public static final int tabLabel=0x7f050001;
+ public static final int tabSelectedDivider=0x7f050002;
+ public static final int tabSplitter=0x7f050004;
}
public static final class layout {
- public static final int tab=0x7f030000;
- public static final int tabs=0x7f030001;
- public static final int test=0x7f030002;
+ public static final int main=0x7f030000;
+ public static final int tab=0x7f030001;
}
public static final class string {
public static final int app_name=0x7f040001;
View
@@ -8,4 +8,4 @@
# project structure.
# Project target.
-target=android-3
+target=android-7
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
View
@@ -0,0 +1,23 @@
+<?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="fill_parent"
+ android:layout_height="fill_parent" >
+
+ <TabWidget
+ android:id="@android:id/tabs"
+ android:layout_width="fill_parent"
+ android:layout_height="48dp"
+ android:background="#000"
+ android:gravity="center_horizontal" />
+
+ <FrameLayout
+ android:id="@android:id/tabcontent"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:fadeScrollbars="false"
+ android:fadingEdge="none"
+ android:scrollbars="@null" >
+ </FrameLayout>
+
+</TabHost>
View
@@ -4,19 +4,37 @@
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_gravity="left"
- android:layout_weight="0.2"
android:orientation="vertical" >
- <ImageView
- android:id="@+id/tab_image"
- android:layout_width="28dp"
- android:layout_height="28dp"
- android:src="@drawable/ic_launcher" />
+ <TextView
+ android:id="@+id/tabLabel"
+ android:layout_width="fill_parent"
+ android:layout_height="43dp"
+ android:gravity="center_vertical|center_horizontal"
+ android:textColor="#FFF"
+ android:textSize="14sp" />
+
+ <TextView
+ android:id="@+id/tabSelectedDivider"
+ android:layout_width="fill_parent"
+ android:layout_height="5dp"
+ android:layout_alignParentBottom="true"
+ android:background="#3366CC"
+ android:visibility="gone" />
+
+ <TextView
+ android:id="@+id/tabDivider"
+ android:layout_width="fill_parent"
+ android:layout_height="2dp"
+ android:layout_alignParentBottom="true"
+ android:background="#3366CC" />
<TextView
- android:id="@+id/tab_label"
- android:layout_width="wrap_content"
- android:layout_height="20dp"
- android:text="Label" android:layout_alignParentBottom="true" android:layout_below="@+id/tab_image"/>
+ android:id="@+id/tabSplitter"
+ android:layout_width="1px"
+ android:layout_height="23dp"
+ android:layout_alignParentRight="true"
+ android:layout_marginTop="10dp"
+ android:background="#333" />
</RelativeLayout>
View
@@ -1,13 +0,0 @@
-<?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="fill_parent"
- android:layout_height="fill_parent" >
-
- <TabWidget
- android:id="@android:id/tabs"
- android:layout_width="fill_parent"
- android:layout_height="48dp"
- android:orientation="horizontal" />
-
-</TabHost>
View
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent" >
-
-</LinearLayout>
View
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="hello">Hello World, TutorialTabsActivity!</string>
+ <string name="hello">Hello World, TabTutorialActivity!</string>
<string name="app_name">android-tabs</string>
</resources>
@@ -2,13 +2,16 @@
import android.app.Activity;
import android.os.Bundle;
+import android.widget.TextView;
-public class TestTabActivity extends Activity {
+public class TabContentActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- setContentView(R.layout.test);
- }
+ TextView textview = new TextView(this);
+ textview.setText("This is the Artists tab");
+ setContentView(textview);
+ }
}
@@ -0,0 +1,47 @@
+package org.nitindhar.android.tab;
+
+import android.app.TabActivity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.TabHost;
+import android.widget.TextView;
+
+public class TabTutorialActivity extends TabActivity {
+
+ private static TabHost tabHost;
+ private static TabHost.TabSpec spec;
+ private static Intent intent;
+ private static LayoutInflater inflater;
+
+ private View tab;
+ private TextView label;
+ private TextView divider;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ tabHost = getTabHost();
+
+ tab = inflater.inflate(R.layout.tab, getTabWidget(), false);
+ label = (TextView) tab.findViewById(R.id.tabLabel);
+ label.setText("HOME");
+ divider = (TextView) tab.findViewById(R.id.tabSelectedDivider);
+ divider.setVisibility(View.VISIBLE);
+ intent = new Intent(TabTutorialActivity.this, TabContentActivity.class);
+ spec = tabHost.newTabSpec("home").setIndicator(tab).setContent(intent);
+ tabHost.addTab(spec);
+
+ tab = inflater.inflate(R.layout.tab, getTabWidget(), false);
+ label = (TextView) tab.findViewById(R.id.tabLabel);
+ label.setText("HOME");
+ intent = new Intent(TabTutorialActivity.this, TabContentActivity.class);
+ spec = tabHost.newTabSpec("home").setIndicator(tab).setContent(intent);
+ tabHost.addTab(spec);
+ }
+}
@@ -1,33 +0,0 @@
-package org.nitindhar.android.tab;
-
-import junit.framework.Test;
-import android.app.TabActivity;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.TabHost;
-
-public class TutorialTabsActivity extends TabActivity {
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.tabs);
-
- TabHost tabHost = getTabHost();
- TabHost.TabSpec spec;
-
- LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- Intent intent = new Intent(this, Test.class);
-
- View tab = inflater.inflate(R.layout.tab, getTabWidget(), false);
- spec = tabHost.newTabSpec("tab").setIndicator(tab).setContent(intent);
- tabHost.addTab(spec);
-
- tab = inflater.inflate(R.layout.tab, getTabWidget(), false);
- spec = tabHost.newTabSpec("tab").setIndicator(tab).setContent(intent);
- tabHost.addTab(spec);
- }
-}

0 comments on commit 1de2f33

Please sign in to comment.