android-pageradapter

Disable swipe in fragmentPagerAdapter? - android

南楼画角 提交于 2020-08-24 06:38:34
问题 Hey guys i have a fragmentPagerAdapter with 3 fragments in it. How would i disable the swiping between the 3 fragments so the user only uses the tabview to go between fragments? Cheers! private class ViewPagerAdapter extends FragmentPagerAdapter { ArrayList<Fragment> fragments = new ArrayList<>(); ArrayList<String> tabTitles = new ArrayList<>(); public ViewPagerAdapter(android.support.v4.app.FragmentManager fragmentManager) { super(fragmentManager); } @Override public Fragment getItem(int

Android Viewpager fragments refreshed when swiped

孤者浪人 提交于 2020-06-26 04:14:31
问题 I am new in Android and I don't really understand why a Fragment 's content which was added dynamically (for example some image which was added after a button click) is disappearing after scrolling some count of Fragment s and then come back. There is really simple code Activity and Fragment : public class MyActivity extends FragmentActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final ViewPager

androidx.navigation:navigation-fragment:2.2.0, get “You must call removeView() on the child's parent first.” on navController.popBackStack()

泪湿孤枕 提交于 2020-04-30 08:51:47
问题 I like use data binding and navigation graph. But after update androidx dependencies from androidx.navigation:navigation-fragment:2.0.0 on 2.2.0 application is crashed after press button "Back". Crash always after return from other fragment to previous fragment containing FragmentPagerAdapter. in build.gradle dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.constraintlayout:constraintlayout:1.1.3' // This is work // implementation 'androidx

androidx.navigation:navigation-fragment:2.2.0, get “You must call removeView() on the child's parent first.” on navController.popBackStack()

半世苍凉 提交于 2020-04-30 08:48:13
问题 I like use data binding and navigation graph. But after update androidx dependencies from androidx.navigation:navigation-fragment:2.0.0 on 2.2.0 application is crashed after press button "Back". Crash always after return from other fragment to previous fragment containing FragmentPagerAdapter. in build.gradle dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.constraintlayout:constraintlayout:1.1.3' // This is work // implementation 'androidx

FragmentStatePagerAdapter first call to getItem wrong with sdk 22-->23 upgrade

痞子三分冷 提交于 2020-02-02 11:09:47
问题 UPDATE 2: Getting rid of all v4 support references fixed it. UPDATE: I started from scratch to see what triggers this behavior. It occurs once I add a check for location permissions. I can't go backwards -- even when I strip out all the permissions code it stays with the incorrectly-bahaving FragmentStatePagerAdapger. I have a FragementStatePagerAdapter that was working just fine for a ViewPager of dynamically created fragments until I changed my compileSdkVersion and target SdkVersion from

ListFragments inside ViewPager

天大地大妈咪最大 提交于 2020-01-14 17:55:11
问题 I'm writing my first fragment-based app and running into some heavy problems which i couldn't solve with the API or Stackoverflow. I am using a viewPager to swipe between two lists. Each list has a header button to create a new list element (similar to the native android alarm app). The button returns currently an error message for debugging. The problem is: FragmentList A returns the debug message for FragmentList B FragmentList B returns no debug message ... // The main class public class

ListFragments inside ViewPager

泄露秘密 提交于 2020-01-14 17:54:12
问题 I'm writing my first fragment-based app and running into some heavy problems which i couldn't solve with the API or Stackoverflow. I am using a viewPager to swipe between two lists. Each list has a header button to create a new list element (similar to the native android alarm app). The button returns currently an error message for debugging. The problem is: FragmentList A returns the debug message for FragmentList B FragmentList B returns no debug message ... // The main class public class

ListFragments inside ViewPager

半腔热情 提交于 2020-01-14 17:53:10
问题 I'm writing my first fragment-based app and running into some heavy problems which i couldn't solve with the API or Stackoverflow. I am using a viewPager to swipe between two lists. Each list has a header button to create a new list element (similar to the native android alarm app). The button returns currently an error message for debugging. The problem is: FragmentList A returns the debug message for FragmentList B FragmentList B returns no debug message ... // The main class public class

How to add gesture detector to a ViewPager

断了今生、忘了曾经 提交于 2020-01-06 19:59:59
问题 What I want to do: Image will be slidable by viewpager but people can zoomIn or zoomOut by gesture detector. Problem: I can slide image using viewpager but don't know to how to add gesture detector in my Viewpager. Code: Activity: public class ImageSlider extends AppCompatActivity { private ViewPager viewPager; CustomSwipeAdpater customSwipeAdpater; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_image_slider)

Image not loading in first page of ViewPager (PagerAdapter)

我怕爱的太早我们不能终老 提交于 2020-01-06 02:28:08
问题 I am new to android development and I am attempting to create a ViewPager with a custom PagerAdapter . In my page adapter layout, I have an CircleImageView and I'm using Ion with a overridden Future callback to download and set the image. However, when the activity loads, the first page has an empty ImageView (the TextViews contain the correct information). When I scroll to the second page, I see the first page's image. This is a continuous cycle until the view is destroyed and I scroll back