2017-01-17 5 views
0

私はリストビューでデータを取得していますが、トーストを使用して検証しましたが、レイアウトで推測するとスワイプしてリストビューdata.Belowがメインのレイアウトファイルです。リストビューをリフレッシュするためにスワイプダウンしてリストデータを表示しない

activity_main.xml

<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.v4.widget.SwipeRefreshLayout 
     android:id="@+id/swipe_refresh_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

    <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" /> 

    <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> 
+0

だけリストビューのために – dex

+0

おかげ.ITが働いていた多くのことをSwipeRefreshLayoutを置きます。 – Addy

+0

これを回答セクションに入れます – dex

答えて

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> 
関連する問題