use of android.support.v13.app.FragmentPagerAdapter in project ViewPagerIndicator by JakeWharton.
the class SampleTabsWithIcons method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.simple_tabs);
FragmentPagerAdapter adapter = new GoogleMusicAdapter(getSupportFragmentManager());
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(adapter);
TabPageIndicator indicator = (TabPageIndicator) findViewById(R.id.indicator);
indicator.setViewPager(pager);
}
use of android.support.v13.app.FragmentPagerAdapter in project ABPlayer by winkstu.
the class DonghuaActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
// 无标题
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.donghua_tab);
backButton = findViewById(R.id.logobutton);
titleText = (TextView) findViewById(R.id.textViewTitle);
FragmentPagerAdapter adapter = null;
mAreaType = getIntent().getIntExtra("AreaType", 1);
Log.d("QAQ", "----->" + mAreaType + titleText.getText());
switch(mAreaType) {
case 1:
titleText.setText("番剧");
adapter = new BankumiTabAdapter(getSupportFragmentManager());
break;
case 2:
titleText.setText("动画");
adapter = new DonghuaTabAdapter(getSupportFragmentManager());
break;
case 3:
titleText.setText("音乐");
adapter = new MusicTabAdapter(getSupportFragmentManager());
break;
case 4:
titleText.setText("游戏");
adapter = new YouxiTabAdapter(getSupportFragmentManager());
break;
case 5:
titleText.setText("科学·技术");
adapter = new KejiTabAdapter(getSupportFragmentManager());
break;
case 6:
titleText.setText("娱乐");
adapter = new YuleTabAdapter(getSupportFragmentManager());
break;
case 7:
titleText.setText("电影");
adapter = new DianyingTabAdapter(getSupportFragmentManager());
break;
case 8:
titleText.setText("排行榜");
adapter = new RankAdapter(getSupportFragmentManager());
break;
default:
titleText.setText("电影");
adapter = new DianyingTabAdapter(getSupportFragmentManager());
break;
}
// 视图切换器
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setOffscreenPageLimit(1);
pager.setAdapter(adapter);
// 页面指示器
PageIndicator indicator = (PageIndicator) findViewById(R.id.indicator);
indicator.setViewPager(pager);
backButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
finish();
}
});
}
use of android.support.v13.app.FragmentPagerAdapter in project ABPlayer by winkstu.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
// 无标题
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentPagerAdapter adapter = new MainTabAdapter(getSupportFragmentManager());
// 视图切换器
ViewPager pager = (ViewPager) findViewById(R.id.pager);
pager.setOffscreenPageLimit(1);
pager.setAdapter(adapter);
// 页面指示器
PageIndicator indicator = (PageIndicator) findViewById(R.id.indicator);
indicator.setViewPager(pager);
/*if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new SubareaFragment())
.commit();
}*/
AdManager.getInstance(this).init("118250e2aa39dea9", "bc5f4490f33da8e6", false);
SpotManager.getInstance(this).loadSpotAds();
SpotManager.getInstance(this).setAnimationType(SpotManager.ANIM_ADVANCE);
SpotManager.getInstance(this).setSpotOrientation(SpotManager.ORIENTATION_PORTRAIT);
AdManager.getInstance(this).setUserDataCollect(true);
}
use of android.support.v13.app.FragmentPagerAdapter in project Android-SpinKit by ybq.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mTabLayout = (TabLayout) findViewById(R.id.tabs);
mViewPager = (ViewPager) findViewById(R.id.viewpager);
mViewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) {
String[] titles = new String[] { "page1", "page2" };
@Override
public Fragment getItem(int position) {
if (position == 0) {
return Page1Fragment.newInstance();
} else {
return Page2Fragment.newInstance();
}
}
@Override
public int getCount() {
return 2;
}
@Override
public CharSequence getPageTitle(int position) {
return titles[position];
}
});
mTabLayout.setupWithViewPager(mViewPager);
}
use of android.support.v13.app.FragmentPagerAdapter in project SeaStar by 13120241790.
the class MainActivity method initView.
private void initView(Fragment mConversationList) {
//颜色变化
mRuPengView = (TextView) this.findViewById(R.id.tv_rupeng);
mConversationListView = (TextView) this.findViewById(R.id.tv_message);
mContactView = (TextView) this.findViewById(R.id.tv_friend);
mSettingView = (TextView) this.findViewById(R.id.tv_setting);
LRuPeng = (LinearLayout) findViewById(R.id.ll_rupeng);
LConversationList = (RelativeLayout) findViewById(R.id.ll_chat);
mUnreadCount = (DragPointView) findViewById(R.id.ss_unreadcount);
LContact = (LinearLayout) findViewById(R.id.ll_friend);
LSetting = (LinearLayout) findViewById(R.id.ll_setting);
mSealIcon = (ImageView) findViewById(R.id.main_seal);
mSealIcon.setBackgroundDrawable(getResources().getDrawable(R.drawable.ic_rong_abnormal));
mMessageIcon = (ImageView) findViewById(R.id.main_message);
mFriends = (ImageView) findViewById(R.id.main_friends);
onlineService = (ImageView) findViewById(R.id.online_service);
onlineService.setOnClickListener(this);
mMy = (ImageView) findViewById(R.id.main_my);
LRuPeng.setOnClickListener(this);
LConversationList.setOnClickListener(this);
LConversationList.setOnLongClickListener(this);
LContact.setOnClickListener(this);
LSetting.setOnClickListener(this);
mUnreadCount.setOnClickListener(this);
mUnreadCount.setDragListencer(this);
mViewPager = (ViewPager) findViewById(R.id.rc_viewpager);
mFriendFragment = FriendsFragment.getInstance();
mFragment.add(SealFragment.getInstance());
mFragment.add(mConversationList);
if (mFriendFragment != null) {
mFragment.add(mFriendFragment);
}
mFragment.add(MineFragment.getInstance());
mFragmentPagerAdapter = new FragmentPagerAdapter(getSupportFragmentManager()) {
@Override
public Fragment getItem(int position) {
return mFragment.get(position);
}
@Override
public int getCount() {
return mFragment.size();
}
};
mViewPager.setAdapter(mFragmentPagerAdapter);
mViewPager.setOffscreenPageLimit(4);
mViewPager.setOnPageChangeListener(this);
}
Aggregations