全国免费服务热线:

18982081108
✕

成都网站维护公司,网站安全维护,网站SEO优化,网站内容运营

FragmentTabHost使用方法详解-创新互联

FragmentTabHost是support-v包下提供的用于集成和管理Fragment页面的组件.

站在用户的角度思考问题,与客户深入沟通,找到芗城网站设计与芗城网站推广的解决方案,凭借多年的经验,让设计与互联网技术结合,创造个性化、用户体验好的作品,建站类型包括:成都网站建设、成都网站设计、企业官网、英文网站、手机端网站、网站推广、申请域名、网络空间、企业邮箱。业务覆盖芗城地区。

今天要实现的效果图如下:


整体结构是MainActivity+5个模块的Fragment.


MainActivity的布局如下:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
 <!--真正的内容视图,用于展示Fragment-->
 <FrameLayout
  android:id="@+id/real_tabcontent"
  android:layout_width="match_parent"
  android:layout_height="0dp"
  android:layout_weight="1"/>

 <!--tabhost,必须使用系统的id-->
 <android.support.v4.app.FragmentTabHost
  android:id="@android:id/tabhost"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  >
  <!--tabcontent,必须使用系统的id-->
  <FrameLayout
   android:id="@android:id/tabcontent"
   android:layout_width="0dp"
   android:layout_height="0dp"
   android:layout_weight="0"/>
 </android.support.v4.app.FragmentTabHost>

</LinearLayout>