I am trying to do a small code having a condition that if the Boolean value set true only all the three relatives should appear in the User Interface. If it is set false, only two layouts should be display. I am able to do this.
My problem is when I am checking the condition and set the View.INVISIBLE condition to the layout2, the gap is appearing between the layouts 1 and 3.
How can I remove this gap? My layouts are created in XML like this:
<RelativeLayout
android:id="@+id/rl_one"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp" />
<RelativeLayout
android:id="@+id/rl_two"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="@+id/rl_one"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp" />
<RelativeLayout
android:id="@+id/rl_three"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_below="@+id/rl_two"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp" />
Thank you.
you should have to use View.GONE in place of View.INVISIBLE .