github ##???1.3.1## #usage:#
android studio ??:
compile 'com.mingle.zzz40500:pulltonextlayout:1.3.1'
activity ???
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<com.mingle.pulltonextlayout.PullToNextLayout
android:id="@+id/pullToNextLayout"
app:underLayoutColor="@color/bg"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/> </RelativeLayout>
???? : ????????? PullToNextLayout
, ??????????
java ???????:
pullToNextLayout= (PullToNextLayout) findViewById(R.id.pullToNextLayout);
list=new ArrayList<>();
for (int i = 0; i < 4; i++) {
list.add(new ScrollViewModel(currentIndex++));
}
adapter= new PullToNextModelAdapter(this,list);
pullToNextLayout.setAdapter(adapter);
pullToNextLayout.setOnItemSelectListener(new OnItemSelectListener() {
@Override
public void onSelectItem(int position, View view) {
setTitle(position+1+".0 ???????????????");
}
}
);
ScrollViewModel
??????:
@Override
public void onCreate(Context context) {
super.onCreate(context);
Log.e(TAG,"onCreate"+"
"+index);
}
/**
* ????
* @return
*/
@Override
public int getLayoutViewId() {
return R.layout.fragment_scrollview;
}
/**
* ?????
* @param v
*/
@Override
public void onBindView(int position, View v, PullToNextView pullToNextView) {
PromptEntity p=new PromptEntity();
TextView titleTV= (TextView) v.findViewById(R.id.titleTV);
TextView contentTv= (TextView) v.findViewById(R.id.textView);
scrollView = (ScrollView) v.findViewById(R.id.scrollView);
titleTV.setText(index+1+".0"+title);
contentTv.setText(content);
Log.e(TAG, "onBindView"+"
"+index);
}
/**
* ?onBindView ?????.
* @param view
*/
@Override
public void onResumeView(int position, View view, PullToNextView pullToNextView) {
super.onResumeView(position, view, pullToNextView);
if(scrollView!=null){
scrollView.pageScroll(ScrollView.FOCUS_UP);
}
Log.e(TAG, "onResumeView"+"
"+index);
}
/**
* ????
* @param view
*/
@Override
public void onUnBindView(int position, View view, PullToNextView pullToNextView) {
super.onUnBindView(position,view,pullToNextView);
Log.e(TAG, "onUnBindView"+"
"+index);
}
@Override
public void onPauseView(int position, View view, PullToNextView pullToNextView) {
super.onPauseView(position,view,pullToNextView);
Log.e(TAG, "onPauseView"+"
"+index);
}
@Override
public void setUserVisibleHint(boolean userVisibleHint) {
super.setUserVisibleHint(userVisibleHint);
if(userVisibleHint){
}
Log.e(TAG, "userVisibleHint" + userVisibleHint+"
" + index);
}
1.3.1 ??
- ???onBindView?????PullToNextView ? position ??
- ????????????.
1.3.0 ??
- ???????.Deprecated ?PullToNextFragmentAdapter,???PullToNextModelAdapter,???????????????.
- ???? sdk9 ;
- ???PullToNextModel ?,?????
1.2.1 ??:
- ????ScrollView ,WebView ???????;
- ??gradle ????;
- ?????,????ViewPager,????????????????;
Q.???????????????:
A. ??(????): res->values->strings.xml ??6?,app??????????????.
<string name="ptn_no_more_data">???????</string>
<string name="ptn_release_to_next">????????</string>
<string name="ptn_pull_up_to_next">????????</string>
<string name="ptn_the_first">????????</string>
<string name="ptn_release_to_previous">????????</string>
<string name="ptn_pull_down_to_previous">????????</string> ??????????? ??(java ??)
pullToNextView.setPromptEntity();
#end#