我正在开发一个应用程序,我在点击按钮时显示标签式布局。现在我希望我的所有标签都可以滚动。任何帮助将不胜感激。
这是我的代码
AndroidTabLayoutActivity类:
public class AndroidTabLayoutActivity extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable 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, MyInfo.class);
spec = tabHost.newTabSpec("MyInfoTab").setIndicator("MyInfo",
res.getDrawable(R.drawable.myinfo))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, Notes.class);
spec = tabHost.newTabSpec("NotesTab").setIndicator("Notes",
res.getDrawable(R.drawable.notes))
.setContent(intent);
tabHost.addTab(spec);
}
}
MyInfo.class
public class MyInfo extends Activity {
ScrollView scroll;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.myinfo);
}
}
Notes.class
public class Notes extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.notes);
// TODO Auto-generated method stub
}
}