1

私はAndroid/Javaを初めて使用し、いくつかのYouTubeチュートリアルに従っており、xmlレイアウトの1つで深刻な問題に遭遇しました。

android:hint基本的に、一部のコードで「XMLの解析エラー:整形式ではありません(無効なトークン)」というエラーが表示されますEditText。私が何を間違えたのか、誰かが私に手がかりを与えることができますか? (ちなみに、コードを機能させようとしていじっていたので、コードが完全に混乱する可能性があります!)

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

1 に答える 1

0
<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>
于 2012-08-06T13:30:00.213 に答える