I have three fragments, the first two filling 80% of the screen and the last one with the rest (this one is never going to change in size). I want to, after input from the user (focus) in a fragment, resize the fragment so it fills 70% of the screen (leaving 10% to the other one). Like this:
It is possible to dinamically change the weight of a fragment? Or there is a better way to achieve this?
This is the code I have right now in the XML:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<FrameLayout android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1.0">
<FrameLayout android:id="@+id/containerParent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".8">
<LinearLayout
android:id="@+id/MainLinear"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="1.0">
<FrameLayout android:id="@+id/fragment1"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight=".5"/>
<FrameLayout android:id="@+id/fragment2"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight=".5"/>
</LinearLayout>
</FrameLayout>
<FrameLayout android:id="@+id/fragment3"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight=".2"/>
</LinearLayout>
</FrameLayout>
</android.support.v4.widget.DrawerLayout>