Skip to content

Commit

Permalink
simple tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
nitindhar7 committed Jan 31, 2012
1 parent a1b8434 commit 1de2f33
Show file tree
Hide file tree
Showing 29 changed files with 117 additions and 76 deletions.
4 changes: 2 additions & 2 deletions .classpath
@@ -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>
5 changes: 3 additions & 2 deletions AndroidManifest.xml
Expand Up @@ -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" />

Expand Down
Empty file removed README.md
Empty file.
Binary file modified bin/android-tabs.apk
Binary file not shown.
Binary file modified bin/classes.dex
Binary file not shown.
Binary file modified bin/classes/org/nitindhar/android/tab/R$id.class
Binary file not shown.
Binary file modified bin/classes/org/nitindhar/android/tab/R$layout.class
Binary file not shown.
Binary file modified bin/classes/org/nitindhar/android/tab/R$string.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added bin/res/drawable-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added bin/res/drawable-ldpi/ic_launcher.png
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
Binary file modified bin/resources.ap_
Binary file not shown.
11 changes: 6 additions & 5 deletions gen/org/nitindhar/android/tab/R.java
Expand Up @@ -15,13 +15,14 @@ public static final class drawable {
}
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;
Expand Down
2 changes: 1 addition & 1 deletion project.properties
Expand Up @@ -8,4 +8,4 @@
# project structure.

# Project target.
target=android-3
target=android-7
Binary file added res/drawable-hdpi/ic_launcher.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/drawable-ldpi/ic_launcher.png
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
23 changes: 23 additions & 0 deletions res/layout/main.xml
@@ -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>
38 changes: 28 additions & 10 deletions res/layout/tab.xml
Expand Up @@ -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>
13 changes: 0 additions & 13 deletions res/layout/tabs.xml

This file was deleted.

6 changes: 0 additions & 6 deletions res/layout/test.xml

This file was deleted.

2 changes: 1 addition & 1 deletion res/values/strings.xml
@@ -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>
Expand Up @@ -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);
}
}
47 changes: 47 additions & 0 deletions src/org/nitindhar/android/tab/TabTutorialActivity.java
@@ -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);
}
}
33 changes: 0 additions & 33 deletions src/org/nitindhar/android/tab/TutorialTabsActivity.java

This file was deleted.

0 comments on commit 1de2f33

Please sign in to comment.