-1

我有一个显示相机预览和按钮的片段,在片段的活动中,我试图隐藏标题栏,但它不起作用。标题栏仍然显示。在活动中:

@Override
public void onCreate(Bundle savedInstanceState) {
    // Hide the window title
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    // Hide the status bar and other OS-level chrome
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);

    super.onCreate(savedInstanceState);
}

我正在关注 Android Programming: The Big Nerd Ranch Guide 一书。

4

2 回答 2

0
@Override
protected void onCreate(final Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    // Make this activity, full screen
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
        WindowManager.LayoutParams.FLAG_FULLSCREEN);

    // Hide the Title bar of this activity screen
    getWindow().requestFeature(Window.FEATURE_NO_TITLE);

    setContentView(R.layout.main);

...

}
于 2015-05-28T18:53:28.870 回答
0

在清单中改变这个

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
于 2015-05-28T19:00:59.687 回答