Типы строк не разрешены (в ‘layout_height’ со значением ‘match-parent’)

#android

#Android

Вопрос:

Я использую вид прокрутки на своей странице активности.В начале xml я использую этот ScrollView, в котором есть разные линейные представления.

  <?xml version="1.0" encoding="utf-8"?>

<ScrollView    
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="match-parent"    
    android:layout_width="match-parent">


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.hsports.bandpop.MainActivity"
    android:orientation="vertical">    

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@ id/title"
        android:text="POP BANDS"
        android:gravity="center"    
        android:textSize="50dp" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_gravity="center"    
        android:paddingTop="100dp" >

    <AutoCompleteTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@ id/username"
        android:hint="Username"
        android:gravity="center"/>

    <AutoCompleteTextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@ id/password"
        android:hint="Password"
        android:gravity="center"
        android:inputType="textPassword"/>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingTop="50dp">

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="SIGN IN"
            android:onClick="checkSignIn"
            android:gravity="center" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="REGISTER"
            android:onClick="registerForm"
            android:gravity="center"/>

</LinearLayout>
    </LinearLayout>


</LinearLayout>
</ScrollView>
  

Ошибка, которую я получаю, это:
Ошибка: (7, 28) Типы строк не разрешены (в ‘layout_height’ со значением ‘match-parent’).
Ошибка: (9, 27) Типы строк не разрешены (в ‘layout_width’ со значением ‘match-parent’).

Комментарии:

1. очистите свой проект и перестройте

Ответ №1:

Это match_parent не match-parent . Обратите внимание на _ и не - . Измените это в своих ScrollView layout_height и layout_width