无法在当前主题中找到样式“textInputStyle”

1 java android user-input android-layout

我对 android 开发和 Android Studio 很陌生。我试图创建一个带有文本输入字段的简单应用程序,以便用户可以输入文本。(再次对此非常陌生,只是在搞 android 开发/工作室)。

无论如何,当我添加了“TextInputLayout”然后从调色板中添加了一个输入文本字段时,我收到了上述错误。

我已尝试按照提示进行刷新。还尝试卸载 Android Studio,不同的 APK。我通过查看清单文件和 style.xml 文件尝试了另一篇关于堆栈溢出的文章中的一些解决方案,但没有任何运气。

想知道是否有人可以再次帮助我解决这个问题我对 android 开发和编程非常陌生,所以这可能是一个简单的解决方案,但我已经没有想法了,哈哈。

下面是我目前拥有“activity_main.xml”文件的代码。

<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <EditText
        android:id="@+id/editText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:ems="10"
        android:hint="@string/input_text"
        android:inputType="text" />

</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

Anu*_*mar 5

这是一个具有支持库依赖项的 android studio 错误。几天前我也遇到了同样的问题。

  • 转到 build.gradle 文件(在 app 文件夹内)。

  • 然后更改支持库的依赖版本——替换28.0.1-alpha328.0.1-alpha1

  • 然后转到styles.xml 文件(在app/res/values 文件夹中)并在名为AppTheme 的样式中添加此项。
    <item name="textInputStyle">@style/Widget.Design.TextInputLayout</item>