This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//viewPager中加载frament方法 | |
//查找是不是已经保存过fragment,优先使用保存过的fragment | |
if(savedInstanceState!=null) { | |
fragment1=(MyGridViewFragment) getChildFragmentManager().getFragment(savedInstanceState, "first"); | |
if((MyGridViewFragment) getChildFragmentManager().getFragment(savedInstanceState, "first")==null) { | |
fragment1=MyGridViewFragment.getInstance(1); | |
} | |
else { | |
fragment1=(MyGridViewFragment) getChildFragmentManager().getFragment(savedInstanceState, "first"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//fragment页签使用方法 | |
//初始化时候将缓存的所有fragment全部隐藏 | |
List<Fragment> fragments=getSupportFragmentManager().getFragments(); | |
if(fragments!=null) { | |
for(int i=0;i<fragments.size();i++) { | |
getSupportFragmentManager().beginTransaction().hide(fragments.get(i)).commit(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//滑动视图 | |
public class MyScrollView extends ViewGroup { | |
Context context; | |
Scroller scroller=null; | |
VelocityTracker tracker=null; | |
//判断点击还是滑动 | |
int touchSlop=0; | |
//滑动速度临界值 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//定义泛型接口 | |
public interface HttpCallBack<T> { | |
public void onSuccess(T result); | |
public void onFail(Throwable throwable); | |
} | |
//定义父类子类model | |
public class ChildModel extends ParentModel { | |
String result; |
NewerOlder