View layout after setvisibility

Posted by user1478296 on Stack Overflow See other posts from Stack Overflow or by user1478296
Published on 2012-06-24T17:05:09Z Indexed on 2012/06/24 21:16 UTC
Read the original article Hit count: 279

Filed under:
|

I've got problem with setting visibility to relative layout. I have part of big layout in relativelayout and below that next TextView. But in my code, when myRelativeLayout.setVisibility(View.GONE); is called, TextView which is below that did not appear. I tried several ways to rearange layout, but i need that textview under it. Thanks

My XML:

<merge xmlns:android="http://schemas.android.com/apk/res/android" >
    <ScrollView
        android:id="@+id/scrollView_liab_ra_flipper_04"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <RelativeLayout
            android:id="@+id/linearLayout_liab_ra_flipper_04"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/someTextView"
                android:text="Something" />

            <!-- This relative layout should be removable -->
            <RelativeLayout
                android:id="@+id/vg_liab_ra_04_flipper_car_container_visible"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@+id/someTextView" >

                <TextView
                    android:id="@+id/tv_1"
                    style="@style/WhiteFormText"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="15dp"
                    android:layout_marginTop="2dp"
                    android:text="@string/licence_plate_counter" >
                </TextView>

                <EditText
                    android:id="@+id/et_1"
                    style="@style/WhiteFormField"
                    android:layout_below="@+id/tv_1"
                    android:hint="@string/licence_plate_hint" >
                </EditText>
            </RelativeLayout>

            <!-- This textview is not visible if relative layout is gone -->
            <TextView
                android:id="@+id/tv_liab_ra_04_flipper_mandat"
                style="@style/WhiteFormTextHint"
                android:layout_below="@+id/vg_liab_ra_04_flipper_car_container_visible"
                android:layout_marginBottom="15dp"
                android:text="@string/mandatory_field" >
            </TextView>
        </RelativeLayout>

    </ScrollView>
</merge>

Java Code:

 private void hideCar() {      

   if (!accident.getParticipant(0)) {
        rlCarContainer.setVisibility(View.GONE);

    } else {
        rlCarContainer.setVisibility(View.VISIBLE);

    }

}

© Stack Overflow or respective owner

Related posts about android

Related posts about relativelayout