我想就我第一次提出这样的问题作我的阐述:
I have already asked a question similar to this. I am getting stuck on the formatting: This is what my code looks like:
<?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">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" />
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/simpleMode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding = "5dip"
android:layout_alignParentLeft="true"
android:src="@drawable/ic_tab_artists_grey" />
<TextView
android:id="@+id/right_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip"
android:layout_toRightOf="@+id/simpleMode"
android:gravity="right"
android:text="Description" />
</RelativeLayout>
</LinearLayout>
</TabHost>
我的项目运行,但绝对没有在屏幕上显示任何情况? 非常感谢帮助!
Here is my activity class: package com.joshi.remotedoc;
import android.app.TabActivity;
import android.os.Bundle;
import android.widget.TabHost;
import android.content.Intent;
import android.content.res.Resources;
public class Detailed_ModeActivity extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.patientmode);
Resources res = getResources();
// Resource object to get Drawables
TabHost tabHost = getTabHost();
// The activity TabHost
TabHost.TabSpec spec;
// Reusable TabSpec for each tab
Intent intent;
// Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this, SimpleMode.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("simpleMode").setIndicator("simpleMode",
res.getDrawable(R.drawable.ic_tab_artists_white))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tabs
intent = new Intent().setClass(this, DetailedMode.class);
spec = tabHost.newTabSpec("2ndtab").setIndicator("MySecondTab", res.getDrawable(R.drawable.something)) .setContent(intent);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("detailedMode").setIndicator("detailedMode",
res.getDrawable(R.drawable.ic_tab_artists_grey))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(2);
}
}