Android 安卓首款NASA每日图像应用程序

Android 安卓首款NASA每日图像应用程序,android,android-layout,Android,Android Layout,我使用的是head first教程,但也使用android studio。程序无法运行;这是我的密码: <TextView android:text="@string/Title" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:text="@string/Date" android:layout_

我使用的是head first教程,但也使用android studio。程序无法运行;这是我的密码:

<TextView
    android:text="@string/Title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<TextView
    android:text="@string/Date"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<TextView
    android:text="@string/Description"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<TextView
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:id=”@+id/imageTitle”
    android:layout_width=”wrap_content”
    android:layout_height=”wrap_content”
    android:text=”@string/Title”/>

<TextView
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:id=”@+id/imageDate”
    android:layout_width=”wrap_content”
    android:layout_height=”wrap_content”
    android:text=”@string/Date”/>

<ImageView
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:id=”@+id/imageDisplay”
    android:layout_width=”wrap_content”
    android:layout_height=”wrap_content”
    android:src=”@drawable/test_image”/>

<TextView
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:id=”@+id/imageDescription”
    android:layout_width=”wrap_content”
    android:layout_height=”wrap_content”
    android:text=”@string/Description”/>

错误:

  Information:Gradle tasks [:app:assembleDebug]
           :app:preBuild
          :app:compileDebugNdk UP-TO-DATE
          :app:preDebugBuild
          :app:checkDebugManifest
          :app:preReleaseBuild
          :app:prepareComAndroidSupportAppcompatV71910Library UP-TO-DATE
          :app:prepareDebugDependencies
           :app:compileDebugAidl UP-TO-DATE
          :app:compileDebugRenderscript UP-TO-DATE
          :app:generateDebugBuildConfig UP-TO-DATE
          :app:generateDebugAssets UP-TO-DATE
          :app:mergeDebugAssets UP-TO-DATE
          :app:generateDebugResValues UP-TO-DATE
          :app:generateDebugResources UP-TO-DATE
          :app:mergeDebugResources UP-TO-DATE
           :app:processDebugManifest UP-TO-DATE
           :app:processDebugResources
                    C:\Users\Ker-    David\AndroidStudioProjects\NasaDailyImage\app\src\main\res\layout\activity_my_nasa_daily_image.xml
    Error:(30) Error parsing XML: not well-formed (invalid token)
    Error:(30) Execution failed for task ':app:processDebugResources'.
    > com.android.ide.common.internal.LoggedErrorException: Failed to run command:
        C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.4W\aapt.exe package -f --no-crunch -I C:\Program Files (x86)\Android\android-studio\sdk\platforms\android-20\android.jar -M C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\manifests\debug\AndroidManifest.xml -S C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\res\debug -A C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\assets\debug -m -J C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\generated\source\r\debug -F C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\libs\app-debug.ap_ --debug-mode --custom-package com.example.ker_david.nasadailyimage -0 apk --output-text-symbols C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\symbols\debug
    Error Code:
        1
    Output:
        C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\res\debug\layout\activity_my_nasa_daily_image.xml:30: error: Error parsing XML: not well-   formed (invalid token)
           Information:BUILD FAILED
            Information:Total time: 6.768 secs
           Information:2 errors
           Information:0 warnings
          Information:See complete output in console`

The C:\Users\Ker-    David\AndroidStudioProjects\NasaDailyImage\app\src\main\res\layout\activity_my_nasa_daily_image.xml
Error:(30) Error parsing XML: not well-formed (invalid token)
Error:(30) Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.4W\aapt.exe package -f --no-crunch -I C:\Program Files (x86)\Android\android-studio\sdk\platforms\android-20\android.jar -M C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\manifests\debug\AndroidManifest.xml -S C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\res\debug -A C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\assets\debug -m -J C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\generated\source\r\debug -F C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\libs\app-debug.ap_ --debug-mode --custom-package com.example.ker_david.nasadailyimage -0 apk --output-text-symbols C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\symbols\debug
Error Code:
    1
Output:
    C:\Users\Ker-David\AndroidStudioProjects\NasaDailyImage\app\build\intermediates\res\debug\layout\activity_my_nasa_daily_image.xml:30: error: Error parsing XML: not well-   formed (invalid token)
       Information:BUILD FAILED
        Information:Total time: 6.768 secs
       Information:2 errors
       Information:0 warnings
      Information:See complete output in console

所有android:id=@+id/imageTitle都给了我属性值expected error

XML的主要问题是所有视图都有两个冗余属性

    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:layout_width=”wrap_content”
    android:layout_height=”wrap_content”

应删除前两行。我还建议对不同的视图使用不同的ID。

如果删除前两行,则会出现错误,提示应定义布局高度和宽度。如果我使用不同的ID,我仍然会出错
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:layout_width=”wrap_content”
    android:layout_height=”wrap_content”