覆盖其他配置中的资源 - Android 工作室



我是Android的新手,我找到了一个网站,作者正在解释如何构建应用程序,他分享了他的代码。但是当我将代码复制到我的 android 工作室时,我收到一个错误,当我按 alt+enter 时,我唯一的选项是"覆盖其他配置中的资源",但当我输入代码时,它似乎没问题。谁能帮助我并给我一个解决方案?这是代码:

<?xml version=”1.0" encoding=”utf-8"?>
<ScrollView android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:android=
xmlns:android="http://schemas.android.com/apk/res/android"”http://schemas.android.com/apk/res/android"
xmlns:app=”http://schemas.android.com/apk/res-auto"
xmlns:tools=”http://schemas.android.com/tools"
android:layout_width=”match_parent”
android:layout_height=”match_parent”>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android"
xmlns:app=”http://schemas.android.com/apk/res-auto"
xmlns:tools=”http://schemas.android.com/tools"
android:layout_width=”match_parent”
android:orientation=”vertical”
android:background=”@drawable/bg”
android:layout_height=”match_parent”
tools:context=”com.example.ekene.blogzone.PostActivity”>
<ImageButton
android:id=”@+id/imageBtn”
android:layout_width=”match_parent”
android:layout_height=”250dp”
android:adjustViewBounds=”true”
android:scaleType=”centerCrop”
android:src=”@drawable/add_img” />
<EditText
android:layout_marginTop=”20dp”
android:id=”@+id/textTitle”
android:background=”@drawable/edit_text_styles”
android:padding=”10dp”
android:textColor=”#fff”
android:textStyle=”bold”
android:hint=”Post Title”
android:layout_marginRight=”5dp”
android:layout_marginLeft=”5dp”
android:layout_width=”match_parent”
android:layout_height=”wrap_content” />
<EditText
android:background=”@drawable/edit_text_styles”
android:padding=”10dp”
android:layout_marginTop=”20dp”
android:hint=”Post Description”
android:textColor=”#fff”
android:id=”@+id/textDesc”
android:layout_marginRight=”5dp”
android:layout_marginLeft=”5dp”
android:layout_width=”match_parent”
android:layout_height=”wrap_content” />
<Button
android:layout_marginTop=”30dp”
android:id=”@+id/postBtn”
android:textColor=”#fff”
android:textStyle=”bold”
android:layout_marginRight=”5dp”
android:layout_marginLeft=”5dp”
android:background=”@drawable/action_button_style”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”Post”/>
</LinearLayout>
</ScrollView>

谢谢。

你的代码有很多错误,比如

xmlns:android=

android.com/apk/res/android" 还存在一种不同的报价。

我已经纠正了它,现在它应该可以正常工作。

这是代码:-

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:background="@drawable/bg"
android:layout_height="match_parent"
tools:context="com.example.ekene.blogzone.PostActivity">
<ImageButton
android:id="@+id/imageBtn"
android:layout_width="match_parent"
android:layout_height="250dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/add_img" />
<EditText
android:layout_marginTop="20dp"
android:id="@+id/textTitle"
android:background="@drawable/edit_text_styles"
android:padding="10dp"
android:textColor="#fff"
android:textStyle="bold"
android:hint="Post Title"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:background="@drawable/edit_text_styles"
android:padding="10dp"
android:layout_marginTop="20dp"
android:hint="Post Description"
android:textColor="#fff"
android:id="@+id/textDesc"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:layout_marginTop="30dp"
android:id="@+id/postBtn"
android:textColor="#fff"
android:textStyle="bold"
android:layout_marginRight="5dp"
android:layout_marginLeft="5dp"
android:background="@drawable/action_button_style"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Post"/>
</LinearLayout>
</ScrollView>

最新更新