Android:ProgressBar导致崩溃

时间:2014-11-20 15:38:29

标签: java android android-layout listview progress-bar

我会用几句话来解释我的问题。 所以我正在解析一些" web"数据到列表视图中。但在我获取所有数据之前,我想显示一个进度条(微调器),其中(当加载数据时)列表视图将在以后显示。 因此,当活动开始时我显示微调器,当获取数据时,我使微调器消失。 我认为我在我的xml文件中做了一些错误。

如果我有这样的话,应用程序崩溃IOException Broken Pipe:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

        <RelativeLayout
        Some stuff   
        </RelativeLayout>

        <RelativeLayout
        Some stuff
        </RelativeLayout>

        <ListView
            android:layout_below="@+id/map"
        </ListView>

        <ProgressBar
            android:layout_below="@+id/map"
        />

        <include layout="@layout/footer" />

    </RelativeLayout>  

如果我喜欢这个,微调器会显示,但列表视图不会出现:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    <RelativeLayout
    Some stuff   
    </RelativeLayout>

    <RelativeLayout
    Some stuff
    </RelativeLayout>

    <ProgressBar
        android:layout_below="@+id/map"
    />

    <ListView
        android:layout_below="@+id/map"
    </ListView>

    <include layout="@layout/footer" />

</RelativeLayout>

控制台:

java.io.IOException: Broken pipe
    at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
    at sun.nio.ch.IOUtil.write(IOUtil.java:65)
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487)
    at com.android.ddmlib.JdwpPacket.writeAndConsume(JdwpPacket.java:213)
    at com.android.ddmlib.Client.sendAndConsume(Client.java:642)
    at com.android.ddmlib.HandleHeap.sendREAQ(HandleHeap.java:347)
    at com.android.ddmlib.Client.requestAllocationStatus(Client.java:488)
    at com.android.ddmlib.DeviceMonitor.createClient(DeviceMonitor.java:831)
    at com.android.ddmlib.DeviceMonitor.openClient(DeviceMonitor.java:799)
    at com.android.ddmlib.DeviceMonitor.processIncomingJdwpData(DeviceMonitor.java:759)
    at com.android.ddmlib.DeviceMonitor.deviceClientMonitorLoop(DeviceMonitor.java:648)
    at com.android.ddmlib.DeviceMonitor.access$100(DeviceMonitor.java:44)
    at com.android.ddmlib.DeviceMonitor$3.run(DeviceMonitor.java:576)

0 个答案:

没有答案