Android layout 可能透支:根元素绘制背景
在我的应用程序中,Android的lints上出现了以下警告: 可能透支:根元素使用 同时绘制背景的主题(推断主题为@android:style/theme) 我想知道如何纠正这个错误,因为在互联网上检查和检查之后,我刚刚发现它正在降低应用程序的速度,这是因为它重新加载了两倍于后台的源代码 这是my layout.xml的来源:Android layout 可能透支:根元素绘制背景,android-layout,Android Layout,在我的应用程序中,Android的lints上出现了以下警告: 可能透支:根元素使用 同时绘制背景的主题(推断主题为@android:style/theme) 我想知道如何纠正这个错误,因为在互联网上检查和检查之后,我刚刚发现它正在降低应用程序的速度,这是因为它重新加载了两倍于后台的源代码 这是my layout.xml的来源: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/main"
android:orientation="vertical" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="120dp"
android:layout_centerHorizontal="true"
android:layout_marginLeft="20dp"
android:text="@string/alta1"
android:textColor="#000"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_marginTop="20dp"
android:layout_centerHorizontal="true"
android:text="@string/alta2"
android:layout_marginLeft="20dp"
android:textColor="#000"
android:textAppearance="?android:attr/textAppearanceSmall" />
<Button
android:id="@+id/continuaralta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/textView2"
android:layout_marginRight="50dp"
android:layout_marginTop="36dp"
android:textStyle="bold"
android:background="@drawable/boton"
android:text="@string/continuar" />
<Button
android:id="@+id/saliralta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/continuaralta"
android:layout_alignBottom="@+id/continuaralta"
android:layout_marginRight="15dp"
android:layout_toLeftOf="@+id/continuaralta"
android:background="@drawable/boton"
android:textStyle="bold"
android:text="@string/salir" />
at的尼尔·塞恩斯伯里(Neil Sainsbury)表示,罗曼·盖伊(Romain Guy)已经解决了at的根本问题。查看Neil的博客并搜索您的错误消息。然后,转至了解如何将背景主题应用于整个应用程序和个人活动
这种方法至少会导致错误消息不再出现。在我的情况下,在进行修复后,点击两个箭头图标刷新lint窗口中的警告是必要的。我不明白你做了什么来修复此问题,你在主题中添加了
@null
?因为我试过了,但我仍然看到了警告。正如我所理解的,它无法修复警告。但是,如果您为背景创建一个样式项,然后将此样式设置为视图,它将修复它。但我认为,这只是权宜之计。您可以忽略此警告,并得到相同的结果。