本文整理汇总了Java中com.shizhefei.view.indicator.Indicator.setOnTransitionListener方法的典型用法代码示例。如果您正苦于以下问题:Java Indicator.setOnTransitionListener方法的具体用法?Java Indicator.setOnTransitionListener怎么用?Java Indicator.setOnTransitionListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.shizhefei.view.indicator.Indicator
的用法示例。
在下文中一共展示了Indicator.setOnTransitionListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.shizhefei.view.indicator.Indicator; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_more_views);
Indicator indicator = (Indicator) findViewById(R.id.moreviews_indicatorView);
ViewPager viewPager = (ViewPager) findViewById(R.id.moreviews_viewPager);
refreshButton = findViewById(R.id.moreviews_refresh_button);
completeButton = findViewById(R.id.moreviews_complete_button);
Class[] fragments = {
RecyclerViewFragment.class,
ListViewFragment.class,
WebViewFragment.class,
TextViewFragment.class,
ScrollViewFragment.class
};
indicator.setScrollBar(new ColorBar(this, ContextCompat.getColor(this, R.color.primary), DisplayUtil.dipToPix(this, 3)));
indicator.setOnTransitionListener(new OnTransitionTextListener().setColor(Color.BLACK, Color.GRAY));
viewPager.setOffscreenPageLimit(2);
indicatorViewPager = new IndicatorViewPager(indicator, viewPager);
indicatorViewPager.setAdapter(pagesAdapter = new PagesAdapter(getSupportFragmentManager(), fragments));
refreshButton.setOnClickListener(onClickListener);
completeButton.setOnClickListener(onClickListener);
}
示例2: onCreate
import com.shizhefei.view.indicator.Indicator; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_more_views);
Indicator indicator = (Indicator) findViewById(R.id.moreviews_indicatorView);
ViewPager viewPager = (ViewPager) findViewById(R.id.moreviews_viewPager);
refreshButton = findViewById(R.id.moreviews_refresh_button);
completeButton = findViewById(R.id.moreviews_complete_button);
headTextView = (TextView) findViewById(R.id.moreviews_headtext_textView);
headTextView.setText("MoreHeaders");
Class[] fragments = {
StateHeaderFragment.class,
JellyHeaderFragment.class,
MaterialHeaderFragment.class,
PinContentMaterialHeaderFragment.class,
TestHeaderFragment.class
};
indicator.setScrollBar(new ColorBar(this, ContextCompat.getColor(this, R.color.primary), DisplayUtil.dipToPix(this, 3)));
indicator.setOnTransitionListener(new OnTransitionTextListener().setColor(Color.BLACK, Color.GRAY));
viewPager.setOffscreenPageLimit(2);
indicatorViewPager = new IndicatorViewPager(indicator, viewPager);
indicatorViewPager.setAdapter(pagesAdapter = new PagesAdapter(getSupportFragmentManager(), fragments));
refreshButton.setOnClickListener(onClickListener);
completeButton.setOnClickListener(onClickListener);
}
示例3: onCreateViewLazy
import com.shizhefei.view.indicator.Indicator; //导入方法依赖的package包/类
@Override
protected void onCreateViewLazy(Bundle savedInstanceState) {
super.onCreateViewLazy(savedInstanceState);
setContentView(R.layout.fragment_tab_news);
ViewPager viewPager = (ViewPager) findViewById(R.id.fragment_tabmain_viewPager);
viewPager.setOffscreenPageLimit(4);
Indicator indicator = (Indicator) findViewById(R.id.fragment_tabmain_indicator);
//设置tab下标
indicator.setScrollBar(new ColorBar(getApplicationContext(),getResources().getColor(R.color.tab_top_scrollbar),5));
float unSelectSize = 14;
float selectSize = unSelectSize * 1.2f;
int selectColor = getResources().getColor(R.color.tab_top_text_2);
int unSelectColor = getResources().getColor(R.color.tab_top_text_1);
indicator.setOnTransitionListener(new OnTransitionTextListener().setColor(selectColor, unSelectColor).setSize(selectSize, unSelectSize));
indicatorViewPager = new IndicatorViewPager(indicator, viewPager);
indicatorViewPager.setPageOffscreenLimit(5);
indicatorViewPager.setAdapter(new NewsFragmentViewPagerAdapter(getChildFragmentManager()));
inflate = LayoutInflater.from(getActivity());
// 注意这里 的FragmentManager 是 getChildFragmentManager(); 因为是在Fragment里面
// 而在activity里面用FragmentManager 是 getSupportFragmentManager()
Log.d("cccc", "Fragment 将要创建View " + this);
}