I have an xml file where I manage the visibility of a framelayout from the java side. the xml have 2 framelayout as button on a linearlayout . the orientation is horizental. Once I hide the first button on the right , the left one stay at his place but it should move to the right.
any ideas how to fix this ?
here is my xml code :
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="bottom|end">
<FrameLayout
android:id="@+id/btn1"
android:layout_width="75dp"
android:layout_height="75dp"
android:background="@drawable/float_button"
android:visibility="gone">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:id="@+id/icon2" />
</FrameLayout>
<FrameLayout
android:id="@+id/btn2"
android:layout_width="75dp"
android:layout_height="75dp"
android:background="@drawable/float_button"
android:visibility="gone">
<ImageView
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_gravity="center"
android:id="@+id/icon1"
>
</ImageView>
</FrameLayout>
</LinearLayout>
my java code :
@Override
public void notifyLayoutReady() {
mHandler.post(new Runnable() {
@Override
public void run() {
if (showUserOption("option1"))
mBtn1.setVisibility(View.VISIBLE);
if (showUserOption("option2"))
mBtn2.setVisibility(View.VISIBLE);
}
});
}