android - Android文件意外结束
问题描述
我正在处理一个项目,但由于文件意外结束而出现错误,并且找不到源。我对 Android Studio 还很陌生,所以我不知道它在哪里关闭。我尝试了不同的结束标签无济于事,所以我不确定在哪里关闭它。任何提示和解决方案表示赞赏!
<?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:background="#fff"
android:orientation="vertical"
android:padding="20dp"
tools:context=".VendorForm">
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:src="@drawable/njftrus"
android:transitionName="logo_image" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-20dp"
android:fontFamily="@font/bungee"
android:text="Welcome,"
android:textColor="#000"
android:textSize="40sp"
android:transitionName="logo_text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Enter information about you and your truck!"
android:textSize="18sp"
android:transitionName="logo_desc" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:orientation="vertical">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/reg_name"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Full Name">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/reg_truckname"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Truck Name"
app:counterMaxLength="15">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/reg_email"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textEmailAddress" />
com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/reg_phoneNo"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Phone No">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="number" />
com.google.android.material.textfield.TextInputLayout>
<Button
android:id="@+id/reg_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000"
android:text="SAVE"
android:textColor="#fff"
android:transitionName="button_tran" />
LinearLayout>
解决方案
All com.google.android.material.textfield.TextInputLayout
are incorrectly closed,
this is a basic xml.
You can either close the tag with />
or if needed to have a child use </tag>
For example:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/reg_truckname"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Truck Name"
app:counterMaxLength="15">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text" />
</com.google.android.material.textfield.TextInputLayout>
Same goes for the very bottom LinearLayout
Basic tutorial: Android Developers - Declaring Layout (XML)
推荐阅读
- junit - PER_CLASS 中的嵌套 PER_METHOD 应该调用 TestInstanceFactory
- java - instanceof 与多态 - 为什么 instanceof 更快?
- c++ - BPL 依赖的范围是什么
- xamarin - MvvmCross:无法安装 Zxing
- java - Android:如何在不触发监听器的情况下在 Firebase 数据库中添加值?
- c# - 获取 xUnit 解决方案目录路径
- cordova - Visual Studio(2017) Tools for Apache Cordova 升级到 XCode 9 后出现错误
- android - Fabric 网络非致命
- apache-spark - 通过 Spark-submit 提交时获取失败的 Spark 作业的退出状态
- javascript - 使用哈巴狗每次循环遍历一组对象