I wanted to make resizable views when one of them is hidden. The question is already asked for iOS in the following link. I wanna make it for android. Any helps are appreciated. I wanted to add free space to three TextViev: position, stat_name, price after setting visibility hidden to count and discount
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="1dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingLeft="5dp"
android:paddingTop="30dp"
android:weightSum="100" >
<TextView
style="@style/list_titles_style"
android:layout_weight="10"
android:text="@string/position" />
<TextView
style="@style/list_titles_style"
android:layout_weight="35"
android:paddingLeft="15dp"
android:text="@string/stat_name" />
<TextView
style="@style/list_titles_style"
android:layout_weight="20"
android:text="@string/price" />
<TextView
android:id="@+id/count_label"
style="@style/list_titles_style"
android:layout_weight="10"
android:visibility="invisible"
android:text="@string/count" />
<TextView
android:id="@+id/discount_label"
style="@style/list_titles_style"
android:visibility="invisible"
android:layout_weight="25"
android:text="@string/discount" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="2dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="1dp"
android:background="@drawable/border_layout"
android:orientation="horizontal" >
<ListView
android:id="@+id/stats_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_marginBottom="5dp"
android:divider="@drawable/list_divider"
android:dividerHeight="2dp"
android:paddingBottom="0dp"
android:paddingLeft="10dp"
android:paddingTop="0dp" />
</LinearLayout>
And my style here it is:
<style name="list_titles_style">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:textColor">@color/Blue</item>
<item name="android:gravity">center</item>
<item name="android:textSize">18sp</item>
</style>