本文整理汇总了Java中com.astuetz.PagerSlidingTabStrip类的典型用法代码示例。如果您正苦于以下问题:Java PagerSlidingTabStrip类的具体用法?Java PagerSlidingTabStrip怎么用?Java PagerSlidingTabStrip使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PagerSlidingTabStrip类属于com.astuetz包,在下文中一共展示了PagerSlidingTabStrip类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (getDialog() != null) {
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getDialog().getWindow().setBackgroundDrawableResource(android.R.color.transparent);
}
View root = inflater.inflate(R.layout.fragment_quick_contact, container, false);
tabs = (PagerSlidingTabStrip) root.findViewById(R.id.tabs);
pager = (ViewPager) root.findViewById(R.id.pager);
adapter = new ContactPagerAdapter();
pager.setAdapter(adapter);
tabs.setViewPager(pager);
return root;
}
示例2: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
pager = (ViewPager) findViewById(R.id.pager);
adapter = new MyPagerAdapter(getSupportFragmentManager());
pager.setAdapter(adapter);
final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
.getDisplayMetrics());
pager.setPageMargin(pageMargin);
tabs.setViewPager(pager);
changeColor(currentColor);
}
示例3: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activty_about);
ActionBar actionBar = getSupportActionBar();
if (actionBar!=null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
ViewPager pager = (ViewPager) findViewById(R.id.pager);
TabsPagerAdapter adapter = new TabsPagerAdapter(getSupportFragmentManager(), this);
pager.setAdapter(adapter);
tabs.setViewPager(pager);
}
示例4: onFinishInflate
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
pager = ((ViewPager) findViewById(R.id.pager));
strip = (PagerSlidingTabStrip) findViewById(R.id.tabs_strip);
strip.setShouldExpand(true);
Adapter adapter = new Adapter(getContext());
pager.setAdapter(adapter);
strip.setViewPager(pager);
backspace = findViewById(R.id.backspace);
backspace.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
callback.backspaceClicked();
}
});
if (adapter.recentIds.length == 0) {
pager.setCurrentItem(1);
}
}
示例5: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_demo);
mPagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
mViewPager = (ViewPager) findViewById(R.id.pager);
//设置页面之间的间隔,实际项目中应该用dip转px
mViewPager.setPageMargin(10);
initPageAdapter();
//
mPagerSlidingTabStrip.setViewPager(mViewPager);
}
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:18,代码来源:PagerSlidingTabStripDemoActivity.java
示例6: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.markactivity);
dm = getResources().getDisplayMetrics();
typeface = Typeface.createFromAsset(this.getAssets(),"font/QH.ttf");
button_back = (ImageButton) findViewById(R.id.back);
title = (TextView) findViewById(R.id.bookname);
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
pagerSlidingTabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
setTabsValue();
Intent intent = getIntent();
bookpath_intent = intent.getStringExtra("bookpath");
bookname_intent = intent.getStringExtra("bookname");
viewPager.setAdapter(new MyPagerAdapter(getSupportFragmentManager()));
pagerSlidingTabStrip.setViewPager(viewPager);
button_back.setOnClickListener(this);
title.setText(bookname_intent);
title.setTypeface(typeface);
}
示例7: bind
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
public void bind(final ViewPager viewPager, PagerSlidingTabStrip tabLayout, final FloatingActionButton genericFab) {
viewPager.setPageMargin(viewPager.getResources().getDimensionPixelOffset(R.dimen.divider));
viewPager.setPageMarginDrawable(R.color.blackT12);
viewPager.setOffscreenPageLimit(2);
viewPager.setAdapter(this);
tabLayout.setViewPager(viewPager);
tabLayout.setOnTabReselectedListener(new PagerSlidingTabStrip.OnTabReselectedListener() {
@Override
public void onTabReselected(int position) {
Fragment fragment = getItem(viewPager.getCurrentItem());
if (fragment != null) {
((Scrollable) fragment).scrollToTop();
}
}
});
viewPager.setCurrentItem(mDefaultItem);
toggleFabs(false, genericFab);
}
示例8: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mobi);
viewPager = (ViewPager)findViewById(R.id.viewpager);
myPagerAdapter = new MyPagerAdapter(getFragmentManager());
viewPager.setAdapter(myPagerAdapter);
PagerSlidingTabStrip tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
tabs.setViewPager(viewPager);
measureFragment = new MeasureFragment();
historyFragment = new HistoryFragment();
settingFragment = new SettingFragment();
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
String frValue = sharedPref.getString(SettingFragment.KEY_PARTITION, "");
if (frValue.equals("")) {
calculateFreeSpace("/data");
} else {
calculateFreeSpace(frValue);
}
}
示例9: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_timeline);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
client = TwitterApplication.getRestClient();
pagerAdapter = new TweetsPagerAdapter(getSupportFragmentManager());
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
viewPager.setAdapter(pagerAdapter);
PagerSlidingTabStrip tabStrip = (PagerSlidingTabStrip) findViewById(R.id.tabs);
tabStrip.setViewPager(viewPager);
if (!isOnline()) {
Snackbar.make(viewPager, "No internet connection", Snackbar.LENGTH_LONG).show();
}
}
示例10: onViewCreated
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
unbinder = ButterKnife.bind(this, view);
pager.setAdapter(getAdapter());
final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
.getDisplayMetrics());
pager.setPageMargin(pageMargin);
tabs.setViewPager(pager);
tabs.setOnTabReselectedListener(new PagerSlidingTabStrip.OnTabReselectedListener() {
@Override
public void onTabReselected(int position) {
pager.setCurrentItem(position);
}
});
pager.setCurrentItem(0);
setHasOptionsMenu(true);
}
示例11: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
pager = (ViewPager) findViewById(R.id.pager);
pager.setAdapter(new MyAdapter(getSupportFragmentManager()));
tabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
tabs.setViewPager(pager);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setPopupTheme(R.style.ThemeOverlay_AppCompat_Light);
if (toolbar != null) {
setSupportActionBar(toolbar);
}
}
示例12: onCreateView
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (jsonStringsForChildFragments.size() == 0) {
TextView textView = new TextView(parentActivity);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
textView.setLayoutParams(layoutParams);
textView.setGravity(Gravity.CENTER);
textView.setText(R.string.error_message_no_data);
textView.setTextSize(getResources().getDimensionPixelSize(R.dimen.text_size_large));
return textView;
}
View view = inflater.inflate(R.layout.sliding_tab_host, container, false);
PagerSlidingTabStrip pagerSlidingTabStrip = (PagerSlidingTabStrip) view.findViewById(
R.id.tabs);
ViewPager viewPager = (ViewPager) view.findViewById(R.id.pager);
WeatherForecastPagerAdapter pagerAdapter = new WeatherForecastPagerAdapter(
parentActivity.getSupportFragmentManager());
viewPager.setAdapter(pagerAdapter);
pagerSlidingTabStrip.setViewPager(viewPager);
return view;
}
示例13: onCreateView
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.main_fragment, container, false);
pager = (ViewPager) v.findViewById(R.id.pager);
tabs = (PagerSlidingTabStrip) v.findViewById(R.id.tabs);
adapter = new MyPagerAdapter(getChildFragmentManager());
pager.setAdapter(adapter);
tabs.setViewPager(pager);
final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
.getDisplayMetrics());
pager.setPageMargin(pageMargin);
if(getArguments() == null)
{
pager.setCurrentItem(1);
}
else pager.setCurrentItem(getArguments().getInt("position"));
return v;
}
示例14: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mToolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
mToolbar.setTitle(R.string.app_name);
setSupportActionBar(mToolbar);
mCurrentPageId = PAGE_ID_COLOR_ITEM_LIST;
mColorItemListPage = new ColorItemListPage(this);
mColorItemListPage.setListener(this);
mPaletteListPage = new PaletteListPage(this);
mPaletteListPage.setListener(this);
mFab = (FloatingActionButton) findViewById(R.id.activity_main_fab);
mFab.setOnClickListener(this);
final MyPagerAdapter adapter = new MyPagerAdapter();
mTabs = (PagerSlidingTabStrip) findViewById(R.id.activity_main_tabs);
mViewPager = (ViewPager) findViewById(R.id.activity_main_view_pager);
mViewPager.setAdapter(adapter);
mTabs.setViewPager(mViewPager);
mTabs.setOnPageChangeListener(this);
mMainActivityFlavor = new MainActivityFlavor(this);
}
示例15: onCreate
import com.astuetz.PagerSlidingTabStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mBeyondApplication = (BeyondApplication) getApplication();
mTabs = (PagerSlidingTabStrip) findViewById(R.id.tabs);
mTabs.setShouldExpand(true);
mPager = (ViewPager) findViewById(R.id.pager);
mPagerAdapter = new PagerAdapter(getFragmentManager());
mPager.setAdapter(mPagerAdapter);
mPager.setOffscreenPageLimit(2);
mTabs.setViewPager(mPager);
mTabs.setOnPageChangeListener(this);
// Bind UPnP service
Intent upnpServiceIntent = new Intent(MainActivity.this, BeyondUpnpService.class);
bindService(upnpServiceIntent, mUpnpServiceConnection, Context.BIND_AUTO_CREATE);
// Bind System service
Intent systemServiceIntent = new Intent(MainActivity.this, SystemService.class);
bindService(systemServiceIntent, mSystemServiceConnection, Context.BIND_AUTO_CREATE);
}