我有一个RelativeLayout与一个与父底部对齐的视图.当我调用actionBar.hide()时,视图会在操作栏向上滑动时向上滑动,然后一旦操作栏完全消失,视图就会跳回到底部.
我该如何防止这种情况发生?我希望视图在操作栏向上滑动时保持连接到底部.
标签是底部对齐的. (你在上面看到的灰色东西是一个不同的片段被加载所以忽略它)
码:
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:
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="test" />