本文整理汇总了Java中android.support.v4.view.PagerTitleStrip类的典型用法代码示例。如果您正苦于以下问题:Java PagerTitleStrip类的具体用法?Java PagerTitleStrip怎么用?Java PagerTitleStrip使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PagerTitleStrip类属于android.support.v4.view包,在下文中一共展示了PagerTitleStrip类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getY
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
public static int getY(View view, boolean force) {
if (!force && bufferedY != -1) {
return bufferedY;
}
int newY = view.getMeasuredHeight();
if (view instanceof ViewPager) {
ViewPager viewPager = (ViewPager) view;
for (int i = 0; i < viewPager.getChildCount(); i++) {
View child = viewPager.getChildAt(i);
if (child.getVisibility() != View.GONE &&
(child instanceof PagerTabStrip ||
child instanceof PagerTitleStrip)) {
// Some views use space within the viewPager, but are not part of the page
newY -= child.getMeasuredHeight();
}
}
}
if (newY > 0) {
bufferedY = newY;
}
if (DEBUG) Log.v(LOG_TAG, "getY " + bufferedY);
return bufferedY;
}
示例2: onCreate
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// View pager setup
MainPagerAdapter mainPagerAdapter = new MainPagerAdapter(getSupportFragmentManager());
ViewPager viewPager = (ViewPager) findViewById(R.id.pager);
viewPager.setAdapter(mainPagerAdapter);
// Action bar customisation
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.hide();
}
// Tab strip customisation
PagerTitleStrip pagerTitleStrip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
pagerTitleStrip.setNonPrimaryAlpha(1);
Typeface typeFace = Typeface.createFromAsset(getAssets(), "roboto/RobotoBlack.ttf");
for (int counter = 0; counter < pagerTitleStrip.getChildCount(); counter++) {
if (pagerTitleStrip.getChildAt(counter) instanceof TextView) {
((TextView) pagerTitleStrip.getChildAt(counter)).setTypeface(typeFace);
}
}
}
示例3: onActivityCreated
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if(savedInstanceState != null){
mPrescription = (Prescription) savedInstanceState.getSerializable("DATA");
}
mPager = (ViewPager) getActivity().findViewById(R.id.pager);
mPager.setOffscreenPageLimit(4);
mTitleStrip = (PagerTitleStrip) getActivity().findViewById(R.id.tabs);
// Create list of fragemnts to display
List<Fragment> frags = new ArrayList<Fragment>();
frags.add(DrugInfoFragment.createInstance(mPrescription));
frags.add(DrugWarningFragment.createInstance(mPrescription.getDrugInfo()));
frags.add(DrugSideFragment.createInstance(mPrescription.getDrugInfo()));
frags.add(DrugPrecautionFragment.createInstance(mPrescription.getDrugInfo()));
// Setup fragment pager adapter
FragPagerAdapter adapter = new FragPagerAdapter(getChildFragmentManager(), frags);
mPager.setAdapter(adapter);
}
示例4: onCreateView
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.pager, container, false);
mProgress = view.findViewById(android.R.id.progress);
mPager = (ViewPager) view.findViewById(R.id.pager);
mPagerIndicator = (PagerTitleStrip) view.findViewById(R.id.titles);
mPagerIndicator.setVisibility(showGroups ? View.VISIBLE : View.GONE);
View c = view.findViewById(R.id.bottom_container);
if (c != null) {
c.setVisibility(View.GONE);
}
return view;
}
示例5: onViewCreated
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
PagerTitleStrip tabs = (PagerTitleStrip) view.findViewById(R.id.pager_title_strip);
ViewPager pager = (ViewPager) view.findViewById(R.id.pager);
pager.setAdapter(mPagerAdapter);
}
示例6: onCreateView
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.activity_main, container, false);
mViewPager = (ViewPager) v.findViewById(R.id.mainPager);
mTitleStrip = (PagerTitleStrip) v.findViewById(R.id.pager_title_strip);
mBoardsPagerAdapter = new BoardsPagerAdapter(getActivity().getSupportFragmentManager(), PreferenceManager.getDefaultSharedPreferences(getActivity()), this);
mBoardsPagerAdapter.addBoardsPage();
mViewPager.setAdapter(mBoardsPagerAdapter);
mViewPager.setOnPageChangeListener(this);
return v;
}
示例7: initViews
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
private void initViews(){
pageAdapter=new DetailPagerAdapter(getBaseContext(), getSupportFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(pageAdapter);
layoutDescription=(LinearLayout)findViewById(R.id.layoutDetailDescription);
arrowDown = (ImageView)findViewById(R.id.imageArrowDownDetail);
arrowDown.setOnClickListener(this);
PagerTitleStrip titleStrip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
titleStrip.setTextColor(Color.WHITE);
}
示例8: TitleStrip_OnClick
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
public void TitleStrip_OnClick(View v) {
PagerTitleStrip titleStrip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
if (viewPager.getPagingEnabled()) {
viewPager.setPagingEnabled(false);
titleStrip.setBackgroundColor(Color.parseColor("#222222"));
} else {
viewPager.setPagingEnabled(true);
titleStrip.setBackgroundColor(Color.parseColor("#33b5e5"));
}
}
示例9: onMeasure
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if(getAdapter() != null) {
setOffscreenPageLimit(getAdapter().getCount());
}
int height = 0;
View titleView = null;
for(int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if(child instanceof PagerTabStrip || child instanceof PagerTitleStrip){
titleView = child;
continue;
}
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
int h = child.getMeasuredHeight();
if(h > height) height = h;
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
if(titleView != null) {
titleView.measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
height += titleView.getMeasuredHeight();
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
示例10: onCreateView
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_tutorial_viewpager, container, false);
ViewPager viewPager = (ViewPager) v.findViewById(R.id.vp_tutorial);
PagerTitleStrip pagerTitleStrip = (PagerTitleStrip) v.findViewById(R.id.vp_pager_title);
viewPager.setAdapter(new FragmentTutorialAdapter(getFragmentManager(), getActivity().getApplicationContext()));
pagerTitleStrip.setTextColor(Color.WHITE);
pagerTitleStrip.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
return v;
}
示例11: canScroll
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
@Override
protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) {
if (v instanceof SurfaceView || v instanceof PagerTitleStrip)
return true;
return super.canScroll(v, checkV, dx, x, y);
}
示例12: initUI
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
private void initUI() {
mViewPager = (ViewPager) findViewById(R.id.viewpager);
mOriginImage = (ImageView) findViewById(R.id.original_iv);
PagerTitleStrip titleStrip = (PagerTitleStrip) findViewById(R.id.title);
mViewPager.setAdapter(new FacePageAdapter(getApplicationContext()));
try {
mOriginBt = ((BitmapDrawable) getResources().getDrawable(mRestID)).getBitmap();
mOriginImage.setImageBitmap(mOriginBt);
} catch (Exception e) {
e.printStackTrace();
}
}
示例13: onCreate
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_file);
mRepo = (Repo) getIntent().getSerializableExtra(Repo.TAG);
mViewPager = (ViewPager) findViewById(R.id.pager);
mTabItemPagerAdapter = new TabItemPagerAdapter(getFragmentManager());
mViewPager.setAdapter(mTabItemPagerAdapter);
mViewPager.setOnPageChangeListener(mTabItemPagerAdapter);
Bundle b = new Bundle();
Bundle extras = getIntent().getExtras();
String fileName = extras.getString(TAG_FILE_NAME);
mActivityMode = extras.getShort(TAG_MODE, TAG_MODE_NORMAL);
b.putString(TAG_FILE_NAME, fileName);
if (mRepo != null) {
b.putSerializable(Repo.TAG, mRepo);
mCommitsFragment = CommitsFragment.newInstance(mRepo, FsUtils.getRelativePath(new File(fileName), mRepo.getDir()));
}
if (mRepo == null) {
PagerTitleStrip strip = (PagerTitleStrip) findViewById(R.id.pager_title_strip);
strip.setVisibility(View.GONE);
}
mFileFragment = new ViewFileFragment();
mFileFragment.setArguments(b);
mActivityMode = extras.getShort(TAG_MODE, TAG_MODE_NORMAL);
b.putInt(TAG_MODE, mActivityMode);
getActionBar().setDisplayHomeAsUpEnabled(true);
setTitle(new File(fileName).getName());
}
示例14: onCreate
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mMainView = findViewById(R.id.pager);
mProgress = findViewById(R.id.main_progress);
mViewPager = (ViewPager) mMainView;
mTitleStrip = (PagerTitleStrip) mViewPager.findViewById(R.id.pager_title_strip);
mArrayPager = new ArrayPagerAdapter(getSupportFragmentManager());
mViewPager.setAdapter(mArrayPager);
self = this;
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
if (savedInstanceState != null) {
restoreSavedState(savedInstanceState);
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) {
public void onDrawerOpened(View drawerView) {
// TextView mServerUrl = (TextView) findViewById(R.id.nav_serverurl);
// if ((Me != null) && (mServerUrl != null))
// mServerUrl.setText(Me.getName());
}
};
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
示例15: onCreate
import android.support.v4.view.PagerTitleStrip; //导入依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
System.out.println("进入onCreate");
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
//find();
SysApplication.getInstance().addActivity(this);
clName = (TextView) findViewById(R.id.clName);
mViewPager = (ViewPager) findViewById(R.id.viewpager);
mPagerTitleStrip = (PagerTitleStrip) findViewById(R.id.pagertab);
mPagerTitleStrip.setTextSize(TypedValue.COMPLEX_UNIT_SP, 23);
//将要分页显示的View装入数组中
LayoutInflater inflater = getLayoutInflater();
listView1 = (ListView) (inflater.inflate(R.layout.monday, null)).findViewById(R.id.listMonday);
listView2 = (ListView) (inflater.inflate(R.layout.tuesday, null)).findViewById(R.id.listTuesday);
listView3 = (ListView) (inflater.inflate(R.layout.wednesday, null)).findViewById(R.id.listWednesday);
listView4 = (ListView) (inflater.inflate(R.layout.thursday, null)).findViewById(R.id.listThursday);
listView5 = (ListView) (inflater.inflate(R.layout.friday, null)).findViewById(R.id.listFriday);
//每个页面的Title数据
views = new ArrayList<View>();
views.add(listView1);
views.add(listView2);
views.add(listView3);
views.add(listView4);
views.add(listView5);
titles = new ArrayList<String>();
titles.add("星期一");
titles.add("星期二");
titles.add("星期三");
titles.add("星期四");
titles.add("星期五");
Calendar c = Calendar.getInstance();
c.setTime(new Date(System.currentTimeMillis()));
if (c.get(Calendar.DAY_OF_WEEK) == 1 || c.get(Calendar.DAY_OF_WEEK) == 7)
dayOfWeek = 6;
else {
dayOfWeek = c.get(Calendar.DAY_OF_WEEK) - 2;
}
mViewPager.setAdapter(new MyAdapter());
mViewPager.setOnPageChangeListener(new MyListener());
mViewPager.setCurrentItem(dayOfWeek);
}