是否可以永久删除活动上的导航栏?我想使用出现在平板电脑屏幕按钮上的按钮而不是操作栏来删除该栏。在这里。
我知道不建议您这样做,我没有做出此决定,但我需要这样做。在我的布局上,还有另一个按钮可以退出活动。我的应用程序的其余部分可以具有导航栏。
我找到了这段代码,并对其进行了一些修改。问题是,即使我隐藏了导航栏,也仍然留有黑色空间。我想系统会在考虑导航栏的情况下计算屏幕尺寸?
public static class Content extends ImageView implements View.OnSystemUiVisibilityChangeListener, View.OnClickListener, ActionBar.OnMenuVisibilityListener {
Activity mActivity;
TextView mTitleView;
Button mPlayButton;
SeekBar mSeekView;
boolean mAddedMenuListener;
boolean mMenusOpen;
boolean mPaused;
boolean mNavVisible;
int mLastSystemUiVis;
Runnable mNavHider = new Runnable() {
@Override public void run() {
setNavVisibility(false);
}
};
public Content(Context context, AttributeSet attrs) {
super(context, attrs);
setOnSystemUiVisibilityChangeListener(this);
setOnClickListener(this);
}
public void init(Activity activity, TextView title, Button playButton,
SeekBar seek) {
// This called by the containing activity to supply the surrounding
// state of the video player that it will interact with.
mActivity = activity;
mTitleView = title;
mPlayButton = playButton;
mSeekView = seek;
mPlayButton.setOnClickListener(this);
setPlayPaused(true);
}
@Override protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mActivity != null) {
mAddedMenuListener = true;
mActivity.getActionBar().addOnMenuVisibilityListener(this);
}
}
@Override protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mAddedMenuListener) {
mActivity.getActionBar().removeOnMenuVisibilityListener(this);
}
}
函数式编程
相关分类