我在我的列表视图中获取数据,我通过给Toasts验证但是我想在布局中有些错误,当向下滑动刷新列表视图时,列表不显示数据.Below是我的主要布局文件
activity_main.xml
polls.csv
答案 0 :(得分:0)
Use SwipeRefreshLayout only for List View i.e
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:background="@android:color/white"
android:layout_height="wrap_content"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/appBarLayout"
android:theme="@style/AppTheme.AppBarOverlay">
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:id="@+id/text_json"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/holo_blue_dark"
android:textColorHighlight="@android:color/primary_text_dark"
android:layout_centerVertical="true"
android:layout_alignParentEnd="true"
android:cacheColorHint="#00000000"
android:textSize="14sp" />
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>