I have fragment witch contains button. Here is layout:
<LinearLayout
android:id="@+id/filters_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/button_open_filters"
style="@style/no_elevation"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.76"
android:background="@drawable/selector_button_search_menu"
android:clickable="true"
android:gravity="start|center_vertical"
android:paddingBottom="@dimen/tv_padding_top_search_menu"
android:paddingLeft="@dimen/et_padding_left"
android:paddingRight="@dimen/et_padding_left"
android:paddingTop="@dimen/tv_padding_top_search_menu"
android:text="@string/button_searchname_all"
android:textColor="@color/dark_white_pressed_selector" />
<ImageButton
android:id="@+id/button_filter"
style="@style/no_elevation"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:background="@drawable/selector_button_search_menu"
android:paddingBottom="@dimen/tv_padding_top_search_menu"
android:paddingTop="@dimen/tv_padding_top_search_menu"
android:src="@drawable/bg_button_filters" />
<ImageButton
android:id="@+id/button_clear_filter"
style="@style/no_elevation"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.12"
android:background="@drawable/selector_button_search_menu"
android:paddingBottom="@dimen/tv_padding_top_search_menu"
android:paddingTop="@dimen/tv_padding_top_search_menu"
android:src="@drawable/selector_button_reset_filters"
android:visibility="gone" />
</LinearLayout>
So button_open_filters has dynamically change text. In fragment i have:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_search, container, false);
if(savedInstanceState != null) {
//some code
} else {
//restore prevous state
}
return view;
}
but in debug mode i see that savedInstanceState has no state for button: android:view_state={2131624078=android.view.AbsSavedState$1@4191c450}
So my question what I'm doing wrong ? State for button is not saved by android, for example i too have Textview that state was saved and propertly restored by android.
Aucun commentaire:
Enregistrer un commentaire