在布局文件的代码里面是没有的,一跑在真机上顶部就会出现一条白色的东西。请问怎么把它去掉》?
阿神2017-04-17 15:25:47
Set the theme to NoActionBar and set it in style.xml:
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
Then set the theme in the Activity in the AndroidManifest.xml file:
android:theme="@style/AppTheme.NoActionBar"
阿神2017-04-17 15:25:47
It has nothing to do with the xml layout file. The white bar above is called the activity default title bar. It has a title bar by default. You can set the theme attribute of the activity (@xxx.NoTitleBar) or set the Window flag to FLAG_NO_TITLE before the activity setContentView
PHPz2017-04-17 15:25:47
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.xxxx);
}
迷茫2017-04-17 15:25:47
This position is also related to the style of the theme. Does the project example you are looking for use toolbar?