覆盖其他配置中的资源-Android Studio

时间:2018-09-10 20:00:58

标签: android xml copy

我是android的新手,我找到了一个网站,作者在其中解释了如何构建应用程序,并与他共享了代码。但是,当我将代码复制到android studio时,我得到一个错误,当我按下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>

谢谢。

1 个答案:

答案 0 :(得分:1)

您的代码有很多错误

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>
相关问题