Skip to content

Commit 9c6bc53

Browse files
author
Chris Banes
committed
Update Ptr Sample so that it's clearer
1 parent 1f50c9b commit 9c6bc53

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="fill_parent"
4+
android:layout_height="fill_parent" >
5+
6+
<!-- The PullToRefreshScrollView replaces a standard PullToRefreshScrollView widget. -->
7+
8+
<com.handmark.pulltorefresh.extras.viewpager.PullToRefreshViewPager
9+
xmlns:ptr="http://schemas.android.com/apk/res-auto"
10+
android:id="@+id/pull_refresh_viewpager"
11+
android:layout_width="fill_parent"
12+
android:layout_height="fill_parent"
13+
ptr:ptrAdapterViewBackground="@android:color/black"
14+
ptr:ptrAnimationStyle="flip"
15+
ptr:ptrHeaderBackground="@android:color/darker_gray"
16+
ptr:ptrMode="both" />
17+
18+
</FrameLayout>

sample/src/com/handmark/pulltorefresh/samples/PullToRefreshViewPagerActivity.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ public class PullToRefreshViewPagerActivity extends Activity implements OnRefres
3636
@Override
3737
public void onCreate(Bundle savedInstanceState) {
3838
super.onCreate(savedInstanceState);
39+
setContentView(R.layout.activity_ptr_viewpager);
3940

40-
mPullToRefreshViewPager = new PullToRefreshViewPager(this);
41-
setContentView(mPullToRefreshViewPager);
42-
41+
mPullToRefreshViewPager = (PullToRefreshViewPager) findViewById(R.id.pull_refresh_viewpager);
4342
mPullToRefreshViewPager.setOnRefreshListener(this);
4443

4544
ViewPager vp = mPullToRefreshViewPager.getRefreshableView();
@@ -82,7 +81,7 @@ public boolean isViewFromObject(View view, Object object) {
8281
return view == object;
8382
}
8483
}
85-
84+
8685
private class GetDataTask extends AsyncTask<Void, Void, Void> {
8786

8887
@Override

0 commit comments

Comments
 (0)