android-viewpager

notifyDataSetChanged and keyboard

故事扮演 提交于 2021-02-08 10:09:15
问题 Why keyboard hiding when I call pagerAdapter.notifyDataSetChanged(); ?? I'm using https://github.com/romannurik/Android-WizardPager . This library using ViewPager. And when i call notifyDataSetChanged and software keyboard is visible, keyboard hiding. public class WizardAdapter extends FragmentStatePagerAdapter { private int cutOffPage = -1; private BaseFragment primaryItem; public WizardAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { return pages.get(i)

notifyDataSetChanged and keyboard

♀尐吖头ヾ 提交于 2021-02-08 10:07:33
问题 Why keyboard hiding when I call pagerAdapter.notifyDataSetChanged(); ?? I'm using https://github.com/romannurik/Android-WizardPager . This library using ViewPager. And when i call notifyDataSetChanged and software keyboard is visible, keyboard hiding. public class WizardAdapter extends FragmentStatePagerAdapter { private int cutOffPage = -1; private BaseFragment primaryItem; public WizardAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { return pages.get(i)

Android viewpager preview behind view

烈酒焚心 提交于 2021-02-08 09:52:49
问题 How can I get something like this sing viewpager in android? I've implemented a viewpager with depth page transformer, but I cant figure out a way to add the preview of the items behind. 回答1: The solution is this library: https://github.com/blipinsk/FlippableStackView 回答2: Here's my solution. I hope it helps. public class StackViewPager extends ViewPager { private static final float FIRST_PAGE_SCALE = 0.9f; private static final float SCALE_FACTOR = 0.1f; // each item scaled down on 10% of

What is the best way to do sliding images in cardview inside recycler?

假装没事ソ 提交于 2021-02-07 11:55:14
问题 I have a RecyclerView with Cardview s. I want sliding images inside this CardView, just like in OLX app. What is the best way to do so? I think about puting viewpager inside cardview. Is it ok or maybe I should try something else? I did it with ViewPager but it looks like too slow. Here is a part of viewpager adapter. @Override public Object instantiateItem(ViewGroup collection, int position) { LayoutInflater inflater = LayoutInflater.from(mContext); ViewGroup layout = (ViewGroup) inflater

ViewPager fast swipes gives IndexOutOfBoundsException

99封情书 提交于 2021-02-07 06:26:25
问题 I have viewpager with fragments.when I try to move viewpager it works fine.but if I swipe fast it gives me below exception. 03-25 11:01:44.901: E/AndroidRuntime(20880): FATAL EXCEPTION: main 03-25 11:01:44.901: E/AndroidRuntime(20880): Process: com.sph.wanbaoandroid, PID: 20880 03-25 11:01:44.901: E/AndroidRuntime(20880): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 03-25 11:01:44.901: E/AndroidRuntime(20880): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList

Android Set Text of TextView in Fragment that is in FragmentPagerAdapter

房东的猫 提交于 2021-02-06 04:21:16
问题 This one is driving me nuts. Basically, I want to create a ViewPager and add a few Fragment s to it. Then, all I want to do, it set a value in one of the Fragment 's TextView s. I can add the Fragment s fine, and they attach, but when I go to findViewById() for one of the TextView s in the first Fragment it throws a NullPointerException . I, for the life of me, can't figure out why. Here's my code so far, let me know if more is needed please. public class SheetActivity extends

Style specific tab using Tablayout and ViewPager2

那年仲夏 提交于 2021-01-29 13:12:24
问题 I'm looking for a way how to style tabs independently like following image: In this case we have different icon, background color and tabIndicator color. Looks like needs to be programmatically because tabs are loaded base on pager adapter. UPDATE After applying @Chhatrasal Singh Bundela answer Seams to have a padding in the tab, do you know how to make it take all tab area. 回答1: You can use TabLayoutMediator class to use viewpager2 with TabLayout . The callback gives you privilege to

I can't load images retrieved from Firebase into a viewpager

扶醉桌前 提交于 2021-01-29 05:34:27
问题 I have uploaded some images using an android application into Firebase storage, now I want to be able to display those images inside a ViewPager in that same application. I have followed a tutorial where they did the same thing but in a RecycleView, and tried to apply the same thing in my code. Now there seems to be no error when I run my code, but I can't view the images inside the imageView. I need help with my ViewPagerAdapter code please, something is missing on the instantiate method and

TabLayout not displaying tab title on Marshmallow

给你一囗甜甜゛ 提交于 2021-01-29 03:54:55
问题 I'm having a strange issue with the titles of my tabs not showing up when I test my app on a marshmallow device. When I test it on all other devices, the titles show up just fine. While debugging, the device hits all of the same points including the the "getPageTitle" method inside my adapter. I've read through many tutorials for using android's TabLayout and ViewPager, just to make absolutely certain I'm not missing anything, and from what I can tell, I am not doing anything wrong. Here is

How to pass custom object arraylist from activity to fragment with instance

假如想象 提交于 2021-01-29 02:50:00
问题 I am using viewpager and creating fragments and i want to pass the arraylist. So i have tried the below things: MainActivity: private ArrayList<customers> mArrayList = null; ViewPagerAdapter adapter = new ViewPagerAdapter(MainActivity.this.getSupportFragmentManager()); adapter.addFrag(NewCustomer.newInstance(mArrayList ), "NewCustomer"); Now in fragment class i am creating instance: public static final ArrayList<customers> data = new ArrayList<customers>(); public static final NewCustomer