02.225 2022-05-23 16:15 采纳率: 37.5%
浏览 187
已结题

Android studio

问题遇到的现象和发生背景

创建一个实时动态天气app,运行虚拟机时报错

问题相关代码,请勿粘贴截图
<?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"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity"
    android:background="@drawable/loginbg">
    <TextView
        android:id="@+id/TV_login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="100dp"
        android:text="用户登录"
        android:textSize="25sp" />
    <LinearLayout
        android:id="@+id/LL"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/TV_login"
        >
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <TextView
                android:id="@+id/TV_username"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:text="用户名"
                android:textSize="25sp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="20dp"/>
            <EditText
                android:id="@+id/ET_username"
                android:layout_width="200dp"
                android:layout_height="40dp"
                android:layout_marginTop="30dp"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">
            <TextView
                android:id="@+id/TV_password"
                android:layout_width="wrap_content"
                android:layout_height="40dp"
                android:text="密    码"
                android:textSize="25sp"
                android:layout_marginLeft="10dp"
                android:layout_marginTop="20dp"/>
            <EditText
                android:id="@+id/ET_password"
                android:layout_width="200dp"
                android:layout_height="40dp"
                android:layout_marginTop="30dp"
                android:password="true"
                />
        </LinearLayout>
        <Button
            android:id="@+id/B_login"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="登录"
            android:textSize="25sp"
            android:layout_marginTop="25dp"
            android:layout_marginLeft="150dp"/>
    </LinearLayout>
</RelativeLayout>
<?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/weatherbg">
    <TextView
        android:id="@+id/TV_city"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="北京"
        android:textSize="50sp"
        android:layout_marginTop="10dp"
        android:="20dp"/>
    <TextView
        android:id="@+id/TV_user"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="200dp"
        android:layout_marginTop="10dp"
        android:text="用户名"
        android:textSize="30sp" />
    <ImageView
        android:id="@+id/TV_icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="100dp"
        android:layout_marginLeft="60dp"
        android:src="@mipmap/ic_launcher"/>
    <TextView
        android:id="@+id/TV_weather"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/TV_icon"
        android:text="多云"
        android:textSize="30sp"
        android:layout_marginTop="10dp"
        android:layout_marginLeft="60dp"/>
    <LinearLayout
        android:id="@+id/LL"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@id/TV_icon"
        android:layout_marginLeft="45dp"
        android:layout_marginStart="45dp"
        android:layout_toEndOf="@id/TV_icon"
        android:layout_toRightOf="@id/TV_icon"
        android:gravity="center"
        android:orientation="vertical"
        >
        <TextView
            android:id="@+id/TV_temp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="-7°"
            android:textSize="25sp"/>
        <TextView
            android:id="@+id/TV_wind"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="风力:三级"
            android:textSize="25sp"/>
        <TextView
            android:id="@+id/TV_pm"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:text="pm"
            android:textSize="25sp"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerVertical="true"
        android:orientation="horizontal"
        android:layout_marginLeft="10dp"
        >
        <Button
            android:onClick="onClick"
            android:id="@+id/Beijing"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="北京"
            android:layout_marginRight="5dp"
            android:layout_marginBottom="20dp"/>
        <Button
            android:onClick="onClick"
            android:id="@+id/Shanghai"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dp"
            android:text="上海" />
        <Button
            android:onClick="onClick"
            android:id="@+id/Guangzhou"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dp"
            android:text="广州" />
        <Button
            android:onClick="onClick"
            android:id="@+id/B_save"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="5dp"
            android:text="存储" />
    </LinearLayout>
</RelativeLayout>

运行结果及报错内容

Unexpected character '=' (code 61) (expected a name start character)
at [row,col {unknown-source}]: [14,17]
Execution failed for task ':app:mergeDebugResources'.

A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
Resource compilation failed (Failed to compile resource file: C:\Users\msipc\AndroidStudioProjects\MyApplication5\app\src\main\res\layout\activity_main2.xml: . Cause: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '=' (code 61) (expected a name start character)
at [row,col {unknown-source}]: [14,17]). Check logs for more details.

  • Try:

    Run with --info or --debug option to get more log output.
    Run with --scan to get full insights.

我想要达到的结果

可以正常运行

  • 写回答

1条回答 默认 最新

  • 不会写代码的猴子 Android领域优质创作者 2022-05-24 13:48
    关注

    img

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 6月2日
  • 已采纳回答 5月25日
  • 创建了问题 5月23日

悬赏问题

  • ¥170 如图所示配置eNSP
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效
  • ¥15 悬赏!微信开发者工具报错,求帮改
  • ¥20 wireshark抓不到vlan
  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥15 键盘指令混乱情况下的启动盘系统重装