android-viewpager

How can I use a PreferenceFragment with a ViewPager?

眉间皱痕 提交于 2019-12-23 01:07:53
问题 I cannot figure out how to get PreferenceFragment to work correctly. I have a ViewPager hooked up to a FragmentPagerAdapter, with two Fragments that the user can swipe between. I am trying to get the "Settings" menu working, using a PreferenceFragment, but I am unsure what I'm doing wrong. When I tap Settings the view is changed to a blank white screen. My SettingsFragment class: public class SettingsFragment extends PreferenceFragment{ @Override public void onCreate(Bundle savedInstanceState

addOnPageChangeListener is undefined

穿精又带淫゛_ 提交于 2019-12-23 01:04:41
问题 I have downloaded a code from Github.I can not run the program.The problem is the method addOnPageChangeListener is undefined.Here's the error: The method addOnPageChangeListener(TabLayout.TabLayoutOnPageChangeListener) is undefined for the type ViewPager What should i do? Should I use another method? Here's the code: import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.FloatingActionButton;

addOnPageChangeListener is undefined

大兔子大兔子 提交于 2019-12-23 01:04:26
问题 I have downloaded a code from Github.I can not run the program.The problem is the method addOnPageChangeListener is undefined.Here's the error: The method addOnPageChangeListener(TabLayout.TabLayoutOnPageChangeListener) is undefined for the type ViewPager What should i do? Should I use another method? Here's the code: import android.support.design.widget.CollapsingToolbarLayout; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.FloatingActionButton;

How to use AsyncTask inside instantiateItem method of PagerAdapter

匆匆过客 提交于 2019-12-23 01:02:22
问题 I wanted to use ViewPager to display some encrypted images. For that I created an extension of PagerAdapter and put my decryption code inside instantiateItem method. But the problem is that the process of decryption takes too long. So, I used AsyncTask inside instantiateItem method to show a progress dialog. Now, ViewPager displays a blank screen at first and I should swipe to view the first image. Moreover setCurrentItem() does not work. My Code: public class FullScreenImageAdapter extends

Can I use Horizontal Scrollview Inside a Viewpager in Android?

ぐ巨炮叔叔 提交于 2019-12-23 01:00:40
问题 Is it possible to make a horizontal scrollview inside viewpager in android ? The HorizontalScrollView should scroll until it reaches its edges, then on next scrolling, should load the next viewpager view. 回答1: your can just make custom xxViewpager extends Viewpager, and Override the canScroll method like below: @Override protected boolean canScroll(View v, boolean checkV, int dx, int x, int y) { if (v instanceof HorizontalScrollView) { return true; } return super.canScroll(v, checkV, dx, x, y

Showing fragment in ViewPager overlapped

烈酒焚心 提交于 2019-12-22 21:15:12
问题 I have an activity with 2 fragments, it uses a ViewPager and a FragmentPagerAdapter. Now it shows only one fragment at a time, I would like to show the fragments a bit overlapped, like in this link. Is it possible to do this without changing structure? In other words, without using MultiPaneLayout or something like that? Thanks everyone 回答1: Try this,It may clears ur problem ViewPager examplePager = (ViewPager) findViewById(R.id.exampleView); examplePager.setPageMargin(-50); examplePager

Android, TabLayout icon color doesn't change when dragging

早过忘川 提交于 2019-12-22 18:23:16
问题 So, I have code like this: tabLayout.setOnTabSelectedListener( new TabLayout.ViewPagerOnTabSelectedListener(tabViewPager) { @Override public void onTabSelected(TabLayout.Tab tab) { super.onTabSelected(tab); //set selected icon color Drawable icon = tab.getIcon(); icon = DrawableCompat.wrap(icon); DrawableCompat.setTint(icon, ContextCompat.getColor(MainActivity.this, R.color.colorAccent)); tab.setIcon(icon); } @Override public void onTabUnselected(TabLayout.Tab tab) { super.onTabUnselected(tab

TitlePageIndicator CirclePageIndicator both on same ViewPager

蓝咒 提交于 2019-12-22 18:14:03
问题 I'm developing an Android 3.1 tablet application. I'm using a ViewPager with Fragments and also I'm using ViewPageIndicator to show a TitlePageIndicator and a CirclePageIndicator. My problem is that I can use both together. public class FillEReportFragmentActivity extends FragmentActivity { private ViewPager mViewPager; private FillEReportFragmentPagerAdapter mPagerAdapter; @Override protected void onCreate(Bundle savedInstance) { super.onCreate(savedInstance); setContentView(R.layout.fill

Viewpager with multiple views inside like “Pulse” app strip [duplicate]

心不动则不痛 提交于 2019-12-22 17:52:17
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Android - Can View Pager have multiple views in per page? I'm using ViewPager according to this wonderful tutorial: http://thepseudocoder.wordpress.com/2011/10/05/android-page-swiping-using-viewpager/ This tutorial shows how to display only one "page" or view in every time/swip. How can I make something like the strip in Pulse app: That have the snapping effect like ViewPager but can have multiple views inside?

Android ViewPager Show Multiple Fragments depending on Screen Size

こ雲淡風輕ζ 提交于 2019-12-22 14:14:12
问题 How can one display multiple Fragment s in a ViewPager according to the screen size; if it is a small device, it would display 1 Fragment in one screen. If it is a tablet in landscape mode, it would display 2 Fragment in a single screen, next to each other. If it is a tablet in portrait mode, it would display 1 Fragment ? 回答1: Inside your ViewPagerAdapter class, override getPageWidth(). It returns a float (default of 1) with the amount of space each page should take up. Changing this value,