gpt4 book ai didi

android - 您必须提供 layout_height 属性

转载 作者:行者123 更新时间:2023-11-30 05:00:14 25 4
gpt4 key购买 nike

我已经学习了使用 Xamarin 的教程,但我遇到了一个问题,它一直显示错误:

Android.Views.InflateException: 'Binary XML file line #2: Binary XML file line #2: You must supply a layout_height attribute.'

我已经检查了我的代码很多次了,layout_height 的所有属性都很好。如果还有其他我没有看到的错误,你们能帮忙通知我吗?

这是我要调试的 XML 文件:

<android.support.constraint.ConstraintLayout
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:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/colorchoose"
android:paddingBottom="10pt"
android:paddingLeft="10pt"
android:paddingRight="10pt"
android:paddingTop="10pt"
android:hapticFeedbackEnabled="false">
<ImageView
android:layout_width="60dp"
android:layout_height="120dp"
android:id="@+id/imageView"
android:layout_marginBottom="8dp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:text="LOGIN"
android:id="@+id/txtlogin"
android:textColor="#fff"
android:layout_width="108dp"
android:layout_height="47dp"
app:layout_constraintTop_toBottomOf="@id/imageView"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginBottom="8dp"
android:textSize="20dp"
android:gravity="center_vertical"
android:textStyle="bold"
android:paddingLeft="3dp"/>
<android.support.design.widget.TextInputLayout
android:id="@+id/etPasswordLayout"
android:layout_width="363dp"
android:layout_height="wrap_content"
app:passwordToggleEnabled="true"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@id/etPasswordLayout1"
android:layout_marginBottom="8dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp">
<android.support.design.widget.TextInputEditText
android:id="@+id/etPassword"
android:layout_width="match_parent"
android:textColor="#fff"
android:hint="Password"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>
<TextView
android:text="Forget Password ? "
android:layout_width="wrap_content"
android:textColor="#fff"
android:layout_height="29dp"
android:id="@+id/textView2"
android:layout_marginBottom="8dp"
app:layout_constraintTop_toBottomOf="@+id/etPasswordLayout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"/>
<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:id="@+id/floatingActionButton"
android:layout_marginTop="170dp"
app:backgroundTint="#FF007F"
android:layout_marginBottom="8dp"
app:layout_constraintTop_toBottomOf="@+id/textView2"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="35dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="50dp"
app:fabSize="mini"/>
<Button
android:text="LOGIN"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button"
android:textColor="#fff"
android:background="#ffca"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintTop_toBottomOf="@+id/textView2"
android:layout_marginBottom="8dp"/>
<android.support.design.widget.TextInputLayout
android:id="@+id/etPasswordLayout1"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:layout_constraintTop_toBottomOf="@id/txtlogin"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp">
<android.support.design.widget.TextInputEditText
android:id="@+id/etPassword1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#fff"
android:hint="Scan PFNo"
android:inputType="textEmailAddress"/>
</android.support.design.widget.TextInputLayout>
</android.support.constraint.ConstraintLayout>

这是我的@drawable/colorchoose xml 文件:它只包含颜色引用

<?xml version="1.0" encoding="utf-8" ?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:startColor="#ffff"
android:endColor="#ffac"
android:angle="45"/>
</shape>
</item>
</selector>

最佳答案

你忘了在这里添加高度:

<android.support.design.widget.TextInputEditText
android:id="@+id/etPassword"
android:layout_width="match_parent"
android:textColor="#fff"
android:hint="Password"
android:inputType="textPassword"/>
</android.support.design.widget.TextInputLayout>

关于android - 您必须提供 layout_height 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58386048/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com