在我的项目运行Android林特我碰到这个警告
可能透支:根元素绘制背景@绘制/主要用 一个主题,也描绘了背景
其中推断的主题是 @android:款式/ Theme.NoTitleBar.Fullscreen
有人能向我解释这是为什么来了,如何删除它?
我的XML:
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:背景=@可绘制/主// ***林特警告***
机器人:方向=垂直
机器人:weightSum =3>
清单中,其中主题定义的一部分
<应用
机器人:图标=@可绘制/ ic_logo
机器人:标签=@字符串/ APP_NAME
机器人:主题=@安卓风格/ Theme.NoTitleBar.Fullscreen>
解决方案
要优化应用程序的性能(避免透支),您可以执行以下操作:
宣布在一个主题 RES /价值/ styles.xml
<样式名称=MyTheme的父=安卓主题>
<项目名称=机器人:背景> @可绘制/主< /项目>
<项目名称=机器人:windowNoTitle>真< /项目>
<项目名称=机器人:windowFullscreen>真< /项目>
< /风格>
修改清单:
<应用
机器人:图标=@可绘制/ ic_logo
机器人:标签=@字符串/ APP_NAME
机器人:主题=@风格/ MyTheme的>
删除背景声明中的我的XML
While running Android Lint on my Project I came across this warning
Possible overdraw: Root element paints background @drawable/main with a theme that also paints a background
Where inferred theme is @android:style/Theme.NoTitleBar.Fullscreen
Can someone explain to me why is this coming and how to remove it ??
My xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/main" //***LINT warning***
android:orientation="vertical"
android:weightSum="3" >
The part of manifest where theme is defined
<application
android:icon="@drawable/ic_logo"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
解决方案
To optimize your apps performance (avoid overdraw), you can do the following:
declare a theme in res/values/styles.xml
<style name="MyTheme" parent="android:Theme">
<item name="android:background">@drawable/main</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>
change the Manifest:
<application
android:icon="@drawable/ic_logo"
android:label="@string/app_name"
android:theme="@style/MyTheme" >
remove the background declaration in "My xml"