当前位置: 首页>>代码示例>>Java>>正文


Java PagerTitleStrip类代码示例

本文整理汇总了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;
}
 
开发者ID:SpiritCroc,项目名称:Modular-Remote,代码行数:24,代码来源:Util.java

示例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);
        }
    }
}
 
开发者ID:appwoodoo,项目名称:appwoodoo-android-sdk,代码行数:27,代码来源:MainActivity.java

示例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);


}
 
开发者ID:hackathon-3d,项目名称:sauce-bosses-repo,代码行数:27,代码来源:DrugViewFragment.java

示例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;
}
 
开发者ID:RayBa82,项目名称:DVBViewerController,代码行数:14,代码来源:ChannelPager.java

示例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);

}
 
开发者ID:Aatik,项目名称:Namaz-Time-Phone-Silencer-Qiblah-Detector,代码行数:10,代码来源:ItemOne.java

示例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;
}
 
开发者ID:Proplex,项目名称:Leaf,代码行数:13,代码来源:PhoneHomeFragment.java

示例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);
}
 
开发者ID:kodamirmo,项目名称:LostAndFound,代码行数:15,代码来源:DetailsActivity.java

示例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"));
	}
}
 
开发者ID:RikardLegge,项目名称:Pi-mediacaster,代码行数:11,代码来源:MainActivity.java

示例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);

}
 
开发者ID:aravindsagar,项目名称:SmartLockScreen,代码行数:33,代码来源:WrapContentViewPager.java

示例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;
}
 
开发者ID:IziOzi,项目名称:IziOzi,代码行数:14,代码来源:FragmentTutorialViewPager.java

示例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);
}
 
开发者ID:ais-albania,项目名称:ZalartAndroid,代码行数:8,代码来源:MapPager.java

示例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();
    }
}
 
开发者ID:Tinker-S,项目名称:FaceBarCodeDemo,代码行数:16,代码来源:ImageFilterActivity.java

示例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());
}
 
开发者ID:sheimi,项目名称:SGit,代码行数:30,代码来源:ViewFileActivity.java

示例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);

    }
 
开发者ID:andresth,项目名称:Kandroid,代码行数:48,代码来源:MainActivity.java

示例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);


}
 
开发者ID:ahhbzyz,项目名称:Timetable,代码行数:60,代码来源:Main.java


注:本文中的android.support.v4.view.PagerTitleStrip类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。