android-viewpager

VideoView ViewPager black lines while swiping

久未见 提交于 2020-01-16 03:48:05
问题 I have a problem with VideoView and ViewPager swiping action. While swiping I can see black lines on the right or left side of VideoView (depends on side of swiping) . How can I deal with this. It was done using FragmentStatePagerAdapter and ViewPager . Parent Activity has SurfaceView with 0px width and height and set getWindow( ).setFormat( PixelFormat.TRANSLUCENT ); I'm adding VideoView from JAVA code. 回答1: VideoView is based of Surfaceview which is not very ideal for translation and other

Storing data in the fragment when activity changes

≯℡__Kan透↙ 提交于 2020-01-16 01:16:14
问题 I would like to design a feed-based app with similar design like Facebook, Twitter or Instagram. In the main screen, I have a FeedActivity which holds a ViewPager for holding 3-4 fragments (represented as tabs) FeedActivity ++ ListOfItemsFragment (there is a ListView holding posts) ++ OtherFragment ++ SomeOtherFragment I would like to open another activity (or maybe another fragment in ViewPager) when a user touches a post (listed in ListOfItemsFragment). If I open this new activity

instantiateItem nor getItem are called on FragmentPagerAdapter

a 夏天 提交于 2020-01-16 00:27:06
问题 I've one activity with a viewpager with a custom FragmentAdapter. Here is my adapter code: this.viewPager.setAdapter(new FragmentPagerAdapter(getSupportFragmentManager()) { SparseArray<WeakReference<Fragment>> registeredFragments = new SparseArray<>(4); @NonNull @Override public Object instantiateItem(ViewGroup container, int position) { Fragment fragment = (Fragment) super.instantiateItem(container, position); this.registeredFragments.put(position, new WeakReference<>(fragment)); return

ViewPager do not behave elastically or get stuck in Views

耗尽温柔 提交于 2020-01-15 15:40:17
问题 I am working on ViewPager but a surprising problem comes up. The ViewPager when scrolled to get next page, it got stuck if I take my finger off from screen , but normally the view should bounce back or next view should come up which it does not. Instead, ViewPager keep stuck in middle of both. I am loading bitmaps via AsyncTask and if I scroll fast there is no problem in loading bitmaps. Here is preview of what I am trying to say - (different color boxes are different screenshot combined in

ViewPager do not behave elastically or get stuck in Views

大兔子大兔子 提交于 2020-01-15 15:39:18
问题 I am working on ViewPager but a surprising problem comes up. The ViewPager when scrolled to get next page, it got stuck if I take my finger off from screen , but normally the view should bounce back or next view should come up which it does not. Instead, ViewPager keep stuck in middle of both. I am loading bitmaps via AsyncTask and if I scroll fast there is no problem in loading bitmaps. Here is preview of what I am trying to say - (different color boxes are different screenshot combined in

onTouchListener in ViewPager

最后都变了- 提交于 2020-01-15 03:18:52
问题 I have an ImageView with onTouchListener inside a ViewPager . Of course the ImageView 's listener fires off when I try to change ViewPager 's page. Is there a way to prevent it. I guess I need to recognize touch from swipe somehow. This is the extract of my code : public class ServerDetailFragment extends Fragment implements SimpleGestureListener { GestureDetector detector; SimpleOnGestureListener gestures = new SimpleOnGestureListener() { public boolean onFling(MotionEvent e1, MotionEvent e2

Android : ViewPager inside DialogFragment : Fragment does not have a view

有些话、适合烂在心里 提交于 2020-01-15 03:11:50
问题 I am trying to create an alertDialog with a pageView inside with a cancel and ok button. The problem is when I set the adapter in the method onCreateDialog , I got: "java.lang.IllegalStateException : Fragment does not have a view". If I comment out this line, I don't have an exception. I have tried also by override the method onCreateView() in the class MyDialog , the problem is the same. Someone have an idea? MainActivity.java public class MainActivity extends FragmentActivity { private

How to disable/ lock one page in viewpager?

一曲冷凌霜 提交于 2020-01-15 03:09:33
问题 I want lock / disable one particular page(fragment) in viewpager. According to scenario for some people only able to access that page. How restrict swiping to that page. I disabled tab click for Events page by using following code : LinearLayout tabStrip = ((LinearLayout)tabLayout.getChildAt(0)); if(!isAccess){ tabStrip.getChildAt(3).setClickable(false); tabStrip.getChildAt(3).setEnabled(false); } But now I need to restrict swiping for that page in view pager. How to do this? 回答1: I written

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