你的位置:首页 > 软件开发 > 操作系统 > Android之TabActivity的使用

Android之TabActivity的使用

发布时间:2015-11-06 22:00:44
TabActivity实现多页显示效果  由于手机屏幕有限,所以我们要尽量充分利用屏幕资源。在我们的应用程序中通常有多个Activity,而且会经常切换显示,这样我们就可以用TabActivity来显示。先看一下效果:    下面我先带领大家实现一下最简单的一种实现:  首先我们 ...

Android之TabActivity的使用

TabActivity实现多页显示效果

  由于手机屏幕有限,所以我们要尽量充分利用屏幕资源。在我们的应用程序中通常有多个Activity,而且会经常切换显示,这样我们就可以用TabActivity来显示。先看一下效果:

  Android之TabActivity的使用

  下面我先带领大家实现一下最简单的一种实现:

  首先我们的布局文件:

<RelativeLayout   ="http://schemas.android.com/tools"  android:layout_width="match_parent"  android:layout_height="match_parent"  tools:context=".Activitytwo" >  <TabHost     android:id="@+id/bookTabHost"    android:layout_width="wrap_content"    android:layout_height="wrap_content"    >    <LinearLayout       android:id="@+id/doneBook"      android:orientation="vertical"      android:layout_height="wrap_content"      android:layout_width="wrap_content"      >      <TextView        android:text="边城"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        />      <TextView        android:text="围城"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        />      <TextView        android:text="追风筝的人"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        />    </LinearLayout>        <LinearLayout       android:id="@+id/doingBook"      android:orientation="vertical"      android:layout_height="wrap_content"      android:layout_width="wrap_content"      >      <TextView        android:text="倾城之恋"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        />      <TextView        android:text="灿烂千阳"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        />      <TextView        android:text="活着"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        />    </LinearLayout>        <LinearLayout       android:id="@+id/willBook"      android:orientation="vertical"      android:layout_height="wrap_content"      android:layout_width="wrap_content"      >      <TextView        android:text="百年孤独"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        />      <TextView        android:text="房子里的大象"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        />      <TextView        android:text="忏悔"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        />    </LinearLayout>  </TabHost></RelativeLayout>

原标题:Android之TabActivity的使用

关键词:Android

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录