-2

この問題が発生するたびに、私はそれを修正することはできません。

ログキャット:

    11-20 12:48:19.842: E/AndroidRuntime(344): FATAL EXCEPTION: main
11-20 12:48:19.842: E/AndroidRuntime(344): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.refreshmedia.nieuwsregio/com.media.news.NewsActivity}: 
                                           java.lang.RuntimeException: Unable to start activity ComponentInfo{com.media.news/com.media.news.Home}:
                                           android.view.InflateException: Binary XML file line #3: Error inflating class Listview
11-20 12:48:19.842: E/AndroidRuntime(344):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
11-20 12:48:19.842: E/AndroidRuntime(344):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-20 12:48:19.842: E/AndroidRuntime(344):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-20 12:48:19.842: E/AndroidRuntime(344):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-20 12:48:19.842: E/AndroidRuntime(344):  at android.os.Handler.dispatchMessage(Handler.java:99)
11-20 12:48:19.842: E/AndroidRuntime(344):  at android.os.Looper.loop(Looper.java:123)
11-20 12:48:19.842: E/AndroidRuntime(344):  at android.app.ActivityThread.main(ActivityThread.java:3683)
11-20 12:48:19.842: E/AndroidRuntime(344):  at java.lang.reflect.Method.invokeNative(Native Method)
11-20 12:48:19.842: E/AndroidRuntime(344):  at java.lang.reflect.Method.invoke(Method.java:507)
11-20 12:48:19.842: E/AndroidRuntime(344):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-20 12:48:19.842: E/AndroidRuntime(344):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-20 12:48:19.842: E/AndroidRuntime(344):  at dalvik.system.NativeStart.main(Native Method)

これは私のXMLファイルです:

<Listview xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/android:list"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="fill_parent">

<TextView android:id="@+id/android:empty"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
  />

</Listview>
4

3 に答える 3

4

大文字/小文字を確認してください -ListViewではないはずですListview(大文字に注意してくださいV)。

于 2012-11-20T12:38:01.920 に答える
1

ListView をメイン レイアウトとして使用することはできません。1 つのメイン レイアウトを使用し、メイン レイアウトに Listview と textview を追加します。また、以下のコードを使用して listview に textview を追加することはできません。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ListView
        android:id="@+id/android:list"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="fill_parent" 
        android:layout_above="@+id/android:empty" />

    <TextView android:id="@+id/android:empty"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:layout_alignParentBottom="true" />

</RelativeLayout>
于 2012-11-20T12:53:22.793 に答える
0

xml にルート ビューまたはレイアウトを追加する必要があります。

これを試して

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    android:orientation="vertical" >

<ListView 
android:id="@+id/android:list"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="fill_parent"/>

<TextView android:id="@+id/android:empty"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
  />
</LinearLayout>
于 2012-11-20T12:46:53.180 に答える