gpt4 book ai didi

安卓类型错误 : Error parsing XML: not well-formed (invalid token)

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

我是 android/java 的新手,一直在关注一些 youtube 教程,但在我的一个 xml 布局上遇到了一个严重的问题。

基本上,我在 EditText 部分的代码的 android:hint 上收到“错误解析 XML:格式不正确(无效 token )”错误。谁能告诉我我做错了什么? (顺便说一句,代码可能会一团糟,因为我一直在乱搞,只是想让它工作!)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="25dp" >

<EditText
android:id="@+id/etCommands"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/Type a command"
android:inputType="true">
</EditText>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >

<Button
android:id="@+id/bResults"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="20"
android:text="@string/Try Command" >
</Button>

<ToggleButton
android:id="@+id/tbPassword"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="80"
android:checked="true"
android:paddingBottom="3dp"
android:text="@string/ToggleButton" />
</LinearLayout>

<TextView
android:id="@+id/tvResults"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/Invalid"
</TextView>

</LinearLayout>

最佳答案

<TextView
android:id="@+id/tvResults"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/Invalid"> <--- you forgot to close bracket here
^^^
</TextView>

并且在您的 EditText 中,您正在从 string.xml

设置提示

并且确保你的string.xml

没有问题
<EditText
android:id="@+id/etCommands"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="SOME HINT" <---- Just try this testing purpose only
android:inputType="true">
</EditText>

关于安卓类型错误 : Error parsing XML: not well-formed (invalid token),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11829271/

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