I have a problem with the children of my FrameLayout when I change their visibility dynamically :
The FrameLayout is composed with a simple ScrollView that is allways visible and a RelativeLayout that represents a search bar and that is gone by default but that can be set to visible dynamically if the user press a button on the action bar.
So when the user press the action bar button and the search bar is GONE, there is no problem, the search bar appears like it has to. But when the search bar is VISIBLE impossible to make her disappear. I don't know why because the state of the bar is well set to GONE when I display it in the log but it's like the FrameLayout was not refreshed.
Someone knows that probleme or has a solution to mine ?
There is the code:
....
<FrameLayout
android:id="@+id/frame_layout_movie_detail"
android:layout_below="@+id/movie_actionbar">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
....
<ImageView
android:id="@+id/iv_movie_detail_poster"
android:scaleType="fitCenter"
android:src="@android:drawable/ic_menu_report_image" />
....
</RelativeLayout>
</ScrollView>
<include
android:id="@+id/include_search_bar_movie"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
layout="@layout/search_bar" />
</FrameLayout>
....
search_bar.xml:
<RelativeLayout
<EditText />
<ImageButton />
</RelativeLayout>
the code to display and hide the search bar:
private void onDisplaySearchBar() {
if (search_bar.getVisibility() == View.GONE)
search_bar.setVisibility(View.VISIBLE);
else
search_bar.setVisibility(View.GONE);
search_bar.invalidate();
}
thanks