當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。