android - Pull to refresh in Main Activity that contains fragments -


I have gone through a lot but I have not found a suitable answer.

I want to apply the drag to refresh I have all gone through the link given below, but everywhere they have simple list view or example in ScrollView for Activity Have given.

Here I have an activity in which 4 pieces and I want to implement the bridge to refresh.

Any kind of help would be greatly appreciated.

Below is my activity XML code:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; LinearLayout xmlns: android = "Http://schemaskandroidkcom/apk/res/android" Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" android: background = "@ color / homePageBackground" android: orientation = "Vertical" & gt; & Lt; Piece android: id = "@ + id / announcementHomefragment" android: name = "in.test.app.AnnouncementFragment" Android: layout_width = "match_parent" Android: layout_height = "wrap_content" / & gt; & Lt; ScrollView Android: layout_width = "match_parent" Android: layout_height = "wrap_content" Android: background = "@color / homepage background" & gt; & Lt; RelativeLayout Android: layout_width = "match_parent" android: layout_height = "wrap_content" Android: Layout_marginBottom = "L5dp" android: background = "@ color / home page background" & gt; Android: Android: layout_marginLeft = "15dp" Android: layout_marginTop = "5dp" Android: Android: Android: Layout_Hild = "rap_content" Android: layout_gravity = "center" Android: layout_margin = "5dp": gravity = "center" android : text = "@ string / Ni_list" android: text = Aprerens "? Android: ATR / text Aprerensmediam" android: text Kolvr = "@ color / white" android: text style = "bold" / & gt; & Lt; Android: layout = "id / newshomefragment" android: name = "in.test.app.NewsFragment" Android: layout_width = "wrap_content" Android: layout_height = "265dp" Android: layout_below = "@ id / newsTitle" Android : Layout_margintop = "-15dp" /> Android: layout_marginLeft = "Android": layout_marginLeft = "Android: Android: Android: layout_width =" wrap-content "15dp" Android: layout_marginTop = "5dp" Android: gravity = "center" Android: text = "@ string / product_in_home "Android: TextAppearance =" android: attr / textAppearanceMedium "Android: textcolor =" @ color / white "android: text style =" bold "/ & gt; & Lt; Android: layout_height = "250dp" Android: layout_below = "@ id / productTitle" android: id = "@ + id / proCategoryhomefragment" Android: name = "in.test.app.CategoryFragment" Android: layout_width = "wrap_content" : Layout_margintop = "-15dp" /> Android: Android: layout_gravity = "center" Android: layout_margin = "Android: Android: layout_wind =" wrap_content "Android: layout_height =" wrap-content "Android: layout_bell =" @ id / processor "Android: Android: text apparatus = "? Android: ATR / Text APRRANsMyDium "Android: Android: Android: Text Color =" @color / white "Android: 15 DP" Android: Layout_Margin Top = "2 DP" Android: Gravity = "Center" Android: Android: Android: Text Style = "bold" /> & Lt; Android: layout_height = "250dp" android: id = "@ + id / trainingfragment" Android: name = "in.test.app.TrainingFragment" Android: layout_width = "wrap_content" Android: layout_height = "250dp" Android: layout_below = "@ id / trainingTitle" Android : Layout_marginbottom = "10dp" Android: layout_margintop = "- 15dp" /> & Lt; / RelativeLayout & gt; & Lt; / Scrollview & gt; Edit    

. It's working fine but when I scroll down my scroll view and trying to go up, it's not going to work, it's not working again. It's refreshing please suggest me How to accomplish this?

Just create a square that extends SwipeRefreshLayout And override method canChildScrollUp () . When you want to scroll down to ListView , return right.

For example,

  @override boolean canChildScrollUp () {Return Listview.getFirstVisibleItemPostion ()! = 0; }    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -