命名空间在Android Studio中未绑定 [英] Namespace is not Bound in Android Studio
本文介绍了命名空间在Android Studio中未绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我创建一个新的XML文件(使用默认的Android Studio创建线性布局"),则Studio会创建一个包含以下内容的文件:
If I create a new XML-file (using the default Android Studio "Create Linear Layout"), Studio makes a file with content:
<?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">
</LinearLayout>
如果我(右键)单击分析...→检查代码",则结果窗口将抛出2次: 名称空间未绑定",并引用了第3行和第7行(LinearLayout标签).这是Studio中的错误吗?
If I (right)-click "Analyze... → Inspect Code" the result window throws 2 times: "Namespace is not bound" and references to line 3 and 7 (the LinearLayout-tags). Is it a bug in Studio?
推荐答案
如果出现错误:
未绑定命名空间工具":
Namespace 'tools' is not bound:
示例:
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
tools:replace="android:theme"
/>
在清单(或活动)顶部添加xmlns:tools ="http://schemas.android.com/tools".
Add xmlns:tools="http://schemas.android.com/tools" at the top of the manifest (or activity).
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mypackage"
xmlns:tools="http://schemas.android.com/tools">
这篇关于命名空间在Android Studio中未绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文