就是说,在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>
怪我咯2017-04-17 17:24:57
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.