Я могу удалить фрагмент, когда я нажимаю кнопку, и у меня есть 2 других фрагмента с удаленным, что я хочу, когда первый фрагмент удален, два других заполняют пустое пространство вызванный удаленным фрагментом.изменить макет фрагмента в mainactivity
и когда я нажимаю на кнопку она будет удалена:
но есть пустое пространство, я хочу два фрагмента, чтобы заполнить пустое пространство правильно
Активность_main_Layout.xml
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<FrameLayout
android:layout_width="87dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:id="@+id/frml"></FrameLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.pack2.t9ahbin.MainActivity"
android:orientation="vertical"
android:id="@+id/linear"
>
<fragment
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.example.pack2.t9ahbin.FragA"
android:id="@+id/fragment"
android:layout_weight="1"
/>
<fragment
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:name="com.example.pack2.t9ahbin.fragB"
android:id="@+id/fragment2"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
Пожалуйста, измените вопрос, чтобы включить компоновки активности без родителя –