android-viewpager

Replace current Fragment in ViewPager on Android

两盒软妹~` 提交于 2019-12-23 10:06:27
问题 I have a ViewPager and I have to replace the first Fragment if a certain action happens. public static class PagerAdapter extends FragmentStatePagerAdapter{ private TempChannel latestChannel; private VideosFragment.SortType sortType; public PagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch (position){ case 0: if(latestChannel == null) { return new LatestVideosFragment(); }else{ return VideosFragment.getVideosFragment(latestChannel,

ViewPager in android is taking full screen?

两盒软妹~` 提交于 2019-12-23 07:03:43
问题 In my xml file I have a Linear layout that has a ViewPager for showing images and another Linear layout that contains previous and Next buttons for selecting images.My xml looks like this: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="fill_parent" android:layout_height="wrap

ViewPager with AsyncTaskLoader

与世无争的帅哥 提交于 2019-12-23 05:26:42
问题 Ok, I'm having hard time of understanding what is wrong with my application. So I have ViewPager with Tabs like this: Adapter.java public class CustomPagerAdapter extends FragmentPagerAdapter { public CustomPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch (position) { case 0: return new Fragment1(); case 1: return new Fragment2(); // And so on... @Override public int getCount() { return 4; } Here is the xml: <android.support.v4.view

Scroll behavior at RecyclerView into vertical view pager

大兔子大兔子 提交于 2019-12-23 05:23:02
问题 I am using VerticalViewPager and two fragments in it. One of this fragment contains RecyclerView with just regular vertical list. The problem is that I need this list to get to end and then change page at view pager and now view pager always try to intercept RecyclerView scroll. My VerticalViewPager class: public class VerticalViewPager extends ViewPager { public VerticalViewPager(Context context) { super(context); init(); } public VerticalViewPager(Context context, AttributeSet attrs) {

Calling methods on the current Fragment in a ViewPager from Activity

和自甴很熟 提交于 2019-12-23 04:46:01
问题 I am listening to network activity in an android application. When events come over the network, I would like to update some TextViews that reside inside of different Fragments in my application. Right now I have a single screen application where one Fragment is on the screen at a time. How can I call a method on an existing Fragment inside of a ViewPager, managed by a FragmentStatePagerAdapter? I am able to "paint" the UI correctly, it gets onscreen as expected. That all works. What I am

Where to Async in PagerAdatper

佐手、 提交于 2019-12-23 04:43:53
问题 My fragment activity used this adapter to display all the result in a listview. The page will have a title tab and each tab will have the list result. Now the list result I read from internal storage and each time I swipe to next page it will have slight lag or delay, so I am thinking implementing ASYNCTask inside this pageradapter so the experience will be better but I have no idea where to implement. Could you guys point me out?? public class ViewPagerAdapter extends PagerAdapter { public

RecyclerView inside viewpager

放肆的年华 提交于 2019-12-23 04:43:12
问题 I try to implement a layout like below image. in this layout first ViewPager has fix height and second Viewpager contain RecyclerView . How can connect scroll RecyclerView in Viewpager to NestedScrollView in parent? I try this: nestedScrollView.isFillViewport = true but RecyclerView scroll from top of Viewpager . 回答1: I have faced this issue some time ago. Where you want RecyclerView to be Scrolled by NestedScrollView . And nestedScrollingEnabled will not help you because RecyclerView is

designing a view pager indicator like this

独自空忆成欢 提交于 2019-12-23 04:35:18
问题 I am creating a view pager indicator like this image , in which icons scroll to center when clicked , How can I achieve this , I have tried View Pager indicator and tabbed layout but no success . 回答1: public class CenteringTabLayout extends TabLayout { private Typeface mTypeface; public CenteringTabLayout(Context context) { super(context); } public CenteringTabLayout(Context context, AttributeSet attrs) { super(context, attrs); } public CenteringTabLayout(Context context, AttributeSet attrs,

designing a view pager indicator like this

强颜欢笑 提交于 2019-12-23 04:35:06
问题 I am creating a view pager indicator like this image , in which icons scroll to center when clicked , How can I achieve this , I have tried View Pager indicator and tabbed layout but no success . 回答1: public class CenteringTabLayout extends TabLayout { private Typeface mTypeface; public CenteringTabLayout(Context context) { super(context); } public CenteringTabLayout(Context context, AttributeSet attrs) { super(context, attrs); } public CenteringTabLayout(Context context, AttributeSet attrs,

adjustPan and adjustResize in nested fragment

爱⌒轻易说出口 提交于 2019-12-23 02:25:24
问题 I use a ViewPager and inside the first fragment of the ViewPager I have a another fragment that is parenting a sub fragment with ScrollView in it. to make it more visual: ┌------------┐ | 1 | 1 is the ViewPager fragment | ┌---------┐| | | 2 || 2 is the fragment inside ViewPager fragment | |┌-------┐|| | ||3 ||| 3 is the sub fragment containing the ScrollView with EditText form | ||form ||| | ||here ||| | || ||| | |└-------┘|| | └---------┘| └------------┘ Issue is: when I use adjustResize it