Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/304.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/algorithm/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 未能找到样式';textInputStyle';当前主题_Java_Android_Android Layout_User Input - Fatal编程技术网

Java 未能找到样式';textInputStyle';当前主题

Java 未能找到样式';textInputStyle';当前主题,java,android,android-layout,user-input,Java,Android,Android Layout,User Input,我对android开发和android Studio非常陌生。我试图创建一个带有文本输入字段的简单应用程序,以便用户可以输入文本。(这还是一个非常新的概念,只是在android开发/工作室里胡闹) 无论如何,当我添加了“TextInputLayout”和调色板中的输入文本字段时,我得到了上面的错误 我已经试着像暗示我的那样提神了。还尝试卸载Android Studio和其他APK。我在另一篇关于堆栈溢出的文章中,通过查看清单文件和style.xml文件,尝试了一些解决方案,但没有任何运气 我想知

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


这是一个android studio bug,它依赖于支持库。几天前我也遇到了同样的问题

  • 转到build.gradle文件(在应用程序文件夹中)

  • 然后更改支持库依赖项的版本--将
    28.0.1-alpha3
    替换为
    28.0.1-alpha1

  • 然后转到styles.xml文件(位于app/res/values文件夹),并将此项目添加到名为AppTheme的样式中。
    @style/Widget.Design.TextInputLayout


这是一个android studio bug,它依赖于支持库。几天前我也遇到了同样的问题

  • 转到build.gradle文件(在应用程序文件夹中)

  • 然后更改支持库依赖项的版本--将
    28.0.1-alpha3
    替换为
    28.0.1-alpha1

  • 然后转到styles.xml文件(位于app/res/values文件夹),并将此项目添加到名为AppTheme的样式中。
    @style/Widget.Design.TextInputLayout


除了上述用户的回答之外,如果您不确定如何确定应该升级或降级哪个版本的支持库,请让Android Studio选择最适合您的版本。只需将+符号放在库的主版本之后,就可以瞄准它,这对我来说非常有效

转到Gradle脚本,打开build.Gradle(模块:app),替换支持库的版本依赖项,如下所示:

dependencies {
implementation 'com.android.support:appcompat-v7:28.+'
..
}

然后转到位于app/res/values文件夹的styles.xml文件,并添加此项目
@style/Widget.Design.TextInputLayout
在名为AppTheme的样式中

<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    <item name="textInputStyle">@style/Widget.Design.TextInputLayout</item>
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

@style/Widget.Design.TextInputLayout
@颜色/原色
@颜色/原色暗
@颜色/颜色重音


希望这对其他人也有帮助。让我知道

除了上述用户的回答,如果您不确定如何确定应升级或降级哪个版本的支持库,请让Android Studio选择最适合您的版本。只需将+符号放在库的主版本之后,就可以瞄准它,这对我来说非常有效

转到Gradle脚本,打开build.Gradle(模块:app),替换支持库的版本依赖项,如下所示:

dependencies {
implementation 'com.android.support:appcompat-v7:28.+'
..
}

然后转到位于app/res/values文件夹的styles.xml文件,并添加此项目
@style/Widget.Design.TextInputLayout
在名为AppTheme的样式中

<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

    <item name="textInputStyle">@style/Widget.Design.TextInputLayout</item>
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

@style/Widget.Design.TextInputLayout
@颜色/原色
@颜色/原色暗
@颜色/颜色重音


希望这对其他人也有帮助。首先让我知道,如果你在res文件中创建主题,那么请使用android:theme=“@style/theme.xyz”在清单文件中找到它,并且在布局设计中,你必须检查是否应用了相同的主题。

首先如果你在res文件中创建主题,请使用android:theme=“@style/theme.xyz”在清单文件中找到它在布局设计中,您必须检查是否应用了相同的主题。

在哪个文件中出现错误??在样式中??在哪里出现错误:/在哪个文件中出现错误??在样式中??在哪里出现错误:/将+添加到渐变依赖项将导致在每24小时内检查一次新版本。将+添加到渐变依赖关系将导致在每24小时内检查一次新版本。