您必须提供layout_height属性

时间:2019-10-15 01:30:56

标签: android xml android-layout debugging xamarin

我已经遵循了使用Xamarin的教程,并且遇到了一个显示错误的问题:

  

Android.Views.InflateException:'二进制XML文件第2行:二进制XML文件第2行:您必须提供layout_height属性。'

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

这是我要调试的XML文件:

<?php

$cleanEmail = $_POST['cust']['email']
$_SESSION['cleanEmail'] = $cleanEmail;

?>

这是我的@ drawable / colorchoose 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>

2 个答案:

答案 0 :(得分:0)

此处缺少height属性:

android.support.design.widget.TextInputEditText

答案 1 :(得分:0)

您忘了在这里增加高度

<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>