布局高度AppCompat未全屏 [英] Layout Height AppCompat Not Full Screen
本文介绍了布局高度AppCompat未全屏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
AppCompat有什么问题? 我的应用程序未使用AppCompat,XML布局没有问题 但是在我使用AppCompat之后,为什么XML布局在屏幕上不完整?
What's wrong with AppCompat? My application does not use AppCompat and there are no problems with XML Layout But after I use AppCompat why is the XML Layout not full on the screen?
我尝试创建一个新的XML布局,但是结果是相同的.
I tried by creating a new XML layout, but the results were the same.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Hello World!"/>
</LinearLayout>
推荐答案
将此主题添加到您的activity
在style.xml
<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
并在AndroidManifest
中为您的活动定义此样式:
and define this style to your activity in AndroidManifest
:
<activity
android:name=".YourActivity"
android:theme="@style/AppTheme"/>
使用此选项将默认删除toolbar
的多余空间.
Using this will remove the extra space coming for toolbar
by default.
这篇关于布局高度AppCompat未全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文