android - 如何在单个碎片fragment中跳转替换整个布局?
伊谢尔伦
伊谢尔伦 2017-04-17 17:22:57
0
1
557

就是说,在mainContent中替换掉整个的mainLinearLayout,请问该怎么操作?我试了replace方法不行

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/mainLinearLayout"
    android:layout_width="match_parent"
    android:fitsSystemWindows="true"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">

    <FrameLayout
        android:id="@+id/mainContent"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" />

    <android.support.v4.app.FragmentTabHost
        android:id="@+id/tabHost"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <FrameLayout
            android:id="@+id/tabContent"
            android:layout_width="0dp"
            android:layout_height="0dp" />
    </android.support.v4.app.FragmentTabHost>


</LinearLayout>
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
刘奇

replace is only for fragment and will only replace mainContent. mainLinearLayout belongs to the activity and can be replaced by the activity's setContentView, but this means that the fragment will also be replaced. Looking at your layout, isn't your intention just to replace mainContent? I don't understand your intention of asking the child to control the parent.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!