如何在TabHost下添加ListView。
哪位高人能给个示例啊。
哪位高人能给个示例啊。
解决方案 »
- eclipse导入项目的问题
- 100分讨论android的动态widget 是在原生的android系统上的,
- Android继承视图怎么用?比如MyTextView extends TextView
- 求助:关于数据库访问
- 我的可以分怎么没有了啊
- 如何在surfaceView的run方法中实现十秒之后跳转到另一个activity
- This tag and its children can be replaced by one <TextView/> and a compound draw
- 服务端区分客户端的标识
- 现在大家是用java开发还是kotlin开发Android应用
- 兄弟们,我在安卓 4.4上运行带兼容API的函数会崩溃,为什么
- 我要如何删除触屏校准程序?
- 在做一个触摸屏测试程序,有个问题想请教下
private ListView bookListView, movieListView, musicListView; protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); tabHost = getTabHost();
LayoutInflater.from(this).inflate(R.layout.result,
tabHost.getTabContentView(), true); tabHost.addTab(tabHost.newTabSpec("book").setIndicator(
getText(R.string.book)).setContent(R.id.ListView_Book));
tabHost.addTab(tabHost.newTabSpec("movie").setIndicator(
getText(R.string.movie)).setContent(R.id.ListView_Movie));
tabHost.addTab(tabHost.newTabSpec("music").setIndicator(
getText(R.string.music)).setContent(R.id.ListView_Music)); tabHost.setOnTabChangedListener(tabListener); bookListView = (ListView) findViewById(R.id.ListView_Book);
movieListView = (ListView) findViewById(R.id.ListView_Movie);
musicListView = (ListView) findViewById(R.id.ListView_Music);
}
}
XML文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"> <ListView android:id="@+id/ListView_Book"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>
<ListView android:id="@+id/ListView_Movie"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>
<ListView android:id="@+id/ListView_Music"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
你设置个默认的不就可以了么 activity刚刚切入的时候加载其中个listView