热门搜索 :
考研考公
您的当前位置:首页正文

FragmentTabHost + FragmentLayout

来源:东饰资讯网

使用FragmentTabHost作为底部,FrameLayout占位,搭建主页框架:

    <FrameLayout
        android:id="@+id/home_content_fl"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@color/color_working_area_bg"
        app:layout_constraintBottom_toTopOf="@+id/home_tab_host"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/home_title_tv" />

    <android.support.v4.app.FragmentTabHost
        android:id="@+id/home_tab_host"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/bottom_background_ll"
        app:layout_constraintBottom_toBottomOf="parent" />

关于子Fragment的生命周期:
首次进入A页面:


创建页面执行的生命周期

切换到B页面:


A切换到B页面A的生命周期变化
B页面切换回A页面:
从B页面切换回A页面时A页面的生命周期

按锁屏键A页面的生命周期:


按锁屏键A页面的生命周期

重新打开屏幕A的生命周期:


重新打开屏幕A的生命周期
Top