i have RelativeLayout
with a view that is aligned to the parent bottom. when i call actionBar.hide()
the view slides up as the action bar slides up, then once the action bar has fully disappeared, the view jumps back to the bottom.
how do i prevent this from happening? i want the view to stay attached to the bottom as the action bar slides up.
can't embed images so here's a link
the tabs are what are bottom aligned. (the grey stuff you see above is a different fragment being loaded so ignore that)
Code:
public class MainFragment extends Fragment {
public View onCreateView(...) {
return inflater.inflate(R.layout.fragment_main);
}
public void onResume() {
super.onResume();
getActivity().getActionBar().hide();
}
public void onPause() {
super.onPause();
getActivity().getActionBar().show();
}
}
R.layout.fragment_main:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="test" />
</RelativeLayout>
Set action bar overlay mode in your AppTheme style:
<item name="android:windowActionBarOverlay">true</item>
<!-- Support library compatibility -->
<item name="windowActionBarOverlay">true</item>
(more info)
and, if you need, set padding or margin in your layout file like this: ?android:attr/actionBarSize
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With