android - 我的 Android Studio 找不到 http ://schemas. android.com/apk/res/android

标签 android xml

我使用 Android Studio 2.2.3 并尝试开发一个带有选项卡的应用程序。但是app的xml代码有URL错误。 我输入如下代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="0dp"
    android:paddingRight="0dp"
    android:paddingTop="0dp"
    app:context="com.example.hojune.prealpha_qna.MainActivity">

<android.support.design.widget.CoordinatorLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.v7.widget.Toolbar
            android:layout_height="?attr/actionBarSize"
            android:layout_width="match_parent"
            android:background="?attr/colorPrimaryDark"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            android:elevation="1dp"
            android:id="@+id/toolbar">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textAppearance="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Title"
                android:text="Learning QnA"/>

        </android.support.v7.widget.Toolbar>

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:tabMode="fixed"
            app:tabGravity="fill"
            app:tabTextColor="@color/colorPrimary"
            app:tabSelectedTextColor="@color/colorAccent"
            app:elevation="1dp"
            android:background="@android:color/background_light"/>

    </android.support.design.widget.AppBarLayout>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/container">

    </FrameLayout>

</android.support.design.widget.CoordinatorLayout>

然后我按下制作项目按钮。但是我的 Android Studio 说:

Error:(2) No resource identifier found for attribute 'context' in package 'com.example.hojune.prealpha_qna'
Error:(2) No resource identifier found for attribute 'context' in package 'com.example.hojune.prealpha_qna'

下面的代码中显示“URL 未注册”:

"http://schemas.android.com/apk/res/android"
"http://schemas.android.com/apk/res-auto"

但其他文件运行良好。 请告诉我应该怎么做。

最佳答案

创建一个新项目并查看布局xml中的url并将当前的替换为它们

关于android - 我的 Android Studio 找不到 http ://schemas. android.com/apk/res/android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43706132/

相关文章:

java - Android OnClickListener 中,通过方法部分更新图像

java - 保存字典供以后在 android java 中阅读

android - 找到三种颜色之间的比例

c# - LINQ 到 XML : How to get all elements by value

java - 使用 StAX : Unrecognized property 'javax.xml.stream.isInterning' 进行 xml 验证

java - Android Studio sqlite 转 ListView

android - 将 gradle 3.3.2 更新到 3.4.0 后意外的构造函数结构

PHP DomDocument XML 加载损坏的 XML 数据

android - 将多个子布局从 XML 文件添加到另一个布局

java - 从dom列表到xml文件的xml解析