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


Java ViewPager.setPageMarginDrawable方法代码示例

本文整理汇总了Java中android.support.v4.view.ViewPager.setPageMarginDrawable方法的典型用法代码示例。如果您正苦于以下问题:Java ViewPager.setPageMarginDrawable方法的具体用法?Java ViewPager.setPageMarginDrawable怎么用?Java ViewPager.setPageMarginDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v4.view.ViewPager的用法示例。


在下文中一共展示了ViewPager.setPageMarginDrawable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpViewPager

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
private void setUpViewPager(ArrayList<Photo> photos) {
    viewPager = (ViewPager) findViewById(R.id.pager);
    viewPager.setAdapter(new DetailViewPagerAdapter(this, photos, sharedElementCallback));
    viewPager.setCurrentItem(initialItem);

    viewPager.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
        @Override
        public void onLayoutChange(View v, int left, int top, int right, int bottom,
                                   int oldLeft, int oldTop, int oldRight, int oldBottom) {
            if (viewPager.getChildCount() > 0) {
                viewPager.removeOnLayoutChangeListener(this);
                startPostponedEnterTransition();
            }
        }
    });

    viewPager.setPageMargin(getResources().getDimensionPixelSize(
            com.example.android.unsplash.base.R.dimen.padding_mini));
    viewPager.setPageMarginDrawable(R.drawable.page_margin);
}
 
开发者ID:googlesamples,项目名称:android-instant-apps,代码行数:21,代码来源:DetailActivity.java

示例2: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.network_monitor_content);

    final ViewPager pager = (ViewPager) findViewById(R.id.network_monitor_pager);

    final FragmentManager fm = getFragmentManager();

    if (pager != null) {
        final ViewPagerTabs pagerTabs = (ViewPagerTabs) findViewById(R.id.network_monitor_pager_tabs);
        pagerTabs.addTabLabels(R.string.network_monitor_peer_list_title, R.string.network_monitor_block_list_title);

        final PagerAdapter pagerAdapter = new PagerAdapter(fm);

        pager.setAdapter(pagerAdapter);
        pager.setOnPageChangeListener(pagerTabs);
        pager.setPageMargin(2);
        pager.setPageMarginDrawable(R.color.bg_less_bright);

        peerListFragment = new PeerListFragment();
        blockListFragment = new BlockListFragment();
    } else {
        peerListFragment = (PeerListFragment) fm.findFragmentById(R.id.peer_list_fragment);
        blockListFragment = (BlockListFragment) fm.findFragmentById(R.id.block_list_fragment);
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:29,代码来源:NetworkMonitorActivity.java

示例3: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.address_book_content);

    final FragmentManager fragmentManager = getFragmentManager();

    walletAddressesFragment = (WalletAddressesFragment) fragmentManager.findFragmentByTag(TAG_LEFT);
    sendingAddressesFragment = (SendingAddressesFragment) fragmentManager.findFragmentByTag(TAG_RIGHT);

    final FragmentTransaction removal = fragmentManager.beginTransaction();

    if (walletAddressesFragment == null)
        walletAddressesFragment = new WalletAddressesFragment();
    else
        removal.remove(walletAddressesFragment);

    if (sendingAddressesFragment == null)
        sendingAddressesFragment = new SendingAddressesFragment();
    else
        removal.remove(sendingAddressesFragment);

    if (!removal.isEmpty()) {
        removal.commit();
        fragmentManager.executePendingTransactions();
    }

    final ViewPager pager = (ViewPager) findViewById(R.id.address_book_pager);
    if (pager != null) {
        pager.setAdapter(
                new TwoFragmentAdapter(fragmentManager, walletAddressesFragment, sendingAddressesFragment));

        final ViewPagerTabs pagerTabs = (ViewPagerTabs) findViewById(R.id.address_book_pager_tabs);
        pagerTabs.addTabLabels(R.string.address_book_list_receiving_title,
                R.string.address_book_list_sending_title);

        pager.setOnPageChangeListener(pagerTabs);
        final int position = 1;
        pager.setCurrentItem(position);
        pager.setPageMargin(2);
        pager.setPageMarginDrawable(R.color.bg_less_bright);

        pagerTabs.onPageSelected(position);
        pagerTabs.onPageScrolled(position, 0, 0);
    } else {
        fragmentManager.beginTransaction().add(R.id.wallet_addresses_fragment, walletAddressesFragment, TAG_LEFT)
                .add(R.id.sending_addresses_fragment, sendingAddressesFragment, TAG_RIGHT).commit();
    }

    updateFragments();
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:53,代码来源:AddressBookActivity.java

示例4: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_image_detail);

    getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
            WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

    getSupportLoaderManager().initLoader(0, null, this);

    //Postpone transition here
    ActivityCompat.postponeEnterTransition(this);

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setPageTransformer(false, new ParallaxPagerTransformer(R.id.image));
    mPagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
    mPager.setAdapter(mPagerAdapter);
    mPager.setPageMargin((int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
    mPager.setPageMarginDrawable(new ColorDrawable(0x22000000));

    mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageScrollStateChanged(int state) {
            super.onPageScrollStateChanged(state);
        }

        @Override
        public void onPageSelected(int position) {
            if (mCursor != null) {
                mCursor.moveToPosition(position);
            }
            mSelectedItemId = mCursor.getLong(GalleryLoader.Query.COLUMN_IMAGE_ID);
        }
    });

    if (savedInstanceState == null) {
        if (getIntent() != null && getIntent().getData() != null) {
            mStartId = GalleryContract.GalleryEntry.getItemId(getIntent().getData());
            mSelectedItemId = mStartId;
        }
    }
}
 
开发者ID:prshntpnwr,项目名称:Monolith,代码行数:44,代码来源:ImageDetailActivity.java

示例5: onCreate

import android.support.v4.view.ViewPager; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_article_detail);

    getSupportLoaderManager().initLoader(0, null, this);

    getWindow().getDecorView().setSystemUiVisibility(
            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                    | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);

    //Postpone transition here
    ActivityCompat.postponeEnterTransition(this);

    mPager = (ViewPager) findViewById(R.id.pager);
    mPager.setPageTransformer(false, new ParallaxPagerTransformer(R.id.photo));
    mPagerAdapter = new MyPagerAdapter(getSupportFragmentManager());
    mPager.setAdapter(mPagerAdapter);
    mPager.setPageMargin((int) TypedValue
            .applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1, getResources().getDisplayMetrics()));
    mPager.setPageMarginDrawable(new ColorDrawable(0x22000000));

    mPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
        @Override
        public void onPageScrollStateChanged(int state) {
            super.onPageScrollStateChanged(state);
        }

        @Override
        public void onPageSelected(int position) {
            if (mCursor != null) {
                mCursor.moveToPosition(position);
            }
            mSelectedItemId = mCursor.getLong(ArticleLoader.Query.COLUMN_ARTICLE_ID);
        }
    });

    if (savedInstanceState == null) {
        if (getIntent() != null && getIntent().getData() != null) {
            mStartId = ArticleContract.ArticleEntry.getItemId(getIntent().getData());
            mSelectedItemId = mStartId;
        }
    }
}
 
开发者ID:prshntpnwr,项目名称:Monolith,代码行数:47,代码来源:ArticleDetailActivity.java


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