嚣张的里拉 2023-05-07 11:55 采纳率: 30%
浏览 203

AndroidStudio报错:Top level element is not completed

在Button组件上加入了LinearLayout组件后,出现了如下的错误:Top level element is not completed。如何更改?以下是我的activity_main.xml文件代码:

<?xml version="1.0" encoding="utf-8"?>
<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:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="10dp"
    android:background="@drawable/background03"
    tools:context=".MainActivity">

    <TextView
        android:id="@+id/tv_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="login"
        android:textColor="@color/white"
        android:textSize="28sp"
        android:maxEms="10"
        android:maxLines="1"
        android:ellipsize="end"
        android:layout_marginTop="250dp"
        android:gravity="center"
    />

    <EditText
        android:id="@+id/et_1"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:textColor="@color/white"
        android:layout_marginTop="5dp"
        android:inputType="textPersonName"
        android:hint="用户名"
        android:maxLines="1"
        android:background="@drawable/bg_username"
        />

    <EditText
        android:id="@+id/et_2"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:textColor="@color/white"
        android:layout_marginTop="5dp"
        android:hint="密 码"
        android:inputType="textPassword"
        android:maxLines="1"
        android:background="@drawable/bg_username"
        />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

    <Button
        android:id="@+id/bu_1"
        android:layout_width="200dp"
        android:layout_height="50dp"
        android:layout_gravity="center"
        android:text="登录" />

    </LinearLayout>

</LinearLayout>


  • 写回答

2条回答 默认 最新

  • 星辰引路-Lefan 2023-05-08 10:05
    关注

    img


    少一个标签

    评论

报告相同问题?

问题事件

  • 创建了问题 5月7日

悬赏问题

  • ¥15 代码在keil5里变成了这样怎么办啊,文件图像也变了,
  • ¥20 Ue4.26打包win64bit报错,如何解决?(语言-c++)
  • ¥15 clousx6整点报时指令怎么写
  • ¥30 远程帮我安装软件及库文件
  • ¥15 关于#自动化#的问题:如何通过电脑控制多相机同步拍照或摄影(相机或者摄影模组数量大于60),并将所有采集的照片或视频以一定编码规则存放至规定电脑文件夹内
  • ¥20 深信服vpn-2050这台设备如何配置才能成功联网?
  • ¥15 Arduino的wifi连接,如何关闭低功耗模式?
  • ¥15 Android studio 无法定位adb是什么问题?
  • ¥15 C#连接不上服务器,
  • ¥15 angular项目错误