android-viewpager

Fragment transaction with viewpager returns blank view

a 夏天 提交于 2020-01-04 03:50:08
问题 I am using tablayout with view pager to display fragments. My current setup is that I get a listview of 'Categories' and the user clicks on a category then returns a new fragment containing a list of available discounts within that category. My setup creates the new DiscountList fragment but does not update the view when the original fragment does its transaction. Could someone help me figure out the correct solution? I am not sure if my viewpager is incorrect or I am missing a step. I can

Caused by java.lang.IllegalStateException: Can't create ViewModelProvider for detached fragment

泄露秘密 提交于 2020-01-04 03:49:10
问题 I need some help to ressolve the following crash. I am refreshing my list on Restart in Activity by calling fragment in viewpager to refresh its list. Following is the stacktrace of the crash: Caused by java.lang.IllegalStateException: Can't create ViewModelProvider for detached fragment at android.arch.lifecycle.ViewModelProviders.checkActivity(ViewModelProviders.java:51) at android.arch.lifecycle.ViewModelProviders.of(ViewModelProviders.java:105) at com.ui.fragments.mainpagerfragments

ViewPager neither shows ActionBar nor PagerSlidingTabStrip

假如想象 提交于 2020-01-04 03:44:07
问题 Below is the code which i have implemented for ViewPager and adding PagerSlidingTabStrip.But my viewpager neither shows ActionBar nor shows PagerSlidingTabStrip.If i try to add actionBar.show() inside onResume() app crashes showing null pointer exception. import android.app.Fragment; import android.os.Bundle; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view

Facebook style slider

喜夏-厌秋 提交于 2020-01-04 02:41:04
问题 the new facebook app has an image slider inside posts which have multiple images. It looks something like this: One thing to notice is the adjacent images are slightly displayed with the current image in focus. I know I can implement a slider using viewpager. But, in a viewpager, the current fragment occupies the entire view. Only the titles of the adjacent views are visible, not the content itself. Can anybody give me a direction to look at for implementing this. Or is there anu opensource

Add PreferenceFragment on FragmentPagerAdapter

99封情书 提交于 2020-01-03 19:31:32
问题 I use the last SDK to create an app with navigation type Tabs + Swipe and I want to put a PreferenceFragment on one of the tabs. The generated code is like : mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); Meanwhile, I can't add PreferenceFragment on the SectionsPagerAdapter because its method getItem(int position)

Not able to Update fragments text while swaping cards

旧街凉风 提交于 2020-01-03 13:18:13
问题 I am working on a card swipe and card flip functionality and I am using ViewPager and fragments. My problem is I am not able to update TextView inside fragments as I swipe the card from left to right or right to left but when I flip the card it update the UI. I tried everything which is available over Internet but none of the soltuion is working for me. I am following this link https://github.com/jamesmccann/android-view-pager-cards Here is my code public class CardContainerFragment extends

Not able to Update fragments text while swaping cards

前提是你 提交于 2020-01-03 13:17:12
问题 I am working on a card swipe and card flip functionality and I am using ViewPager and fragments. My problem is I am not able to update TextView inside fragments as I swipe the card from left to right or right to left but when I flip the card it update the UI. I tried everything which is available over Internet but none of the soltuion is working for me. I am following this link https://github.com/jamesmccann/android-view-pager-cards Here is my code public class CardContainerFragment extends

retain state of viewpager fragments android

核能气质少年 提交于 2020-01-03 13:10:09
问题 I have a viewpager in a fragment in which i am showing 3 fragments but when I open the fragment first time it opens fine and when I move to another fragment and came back to the viewpager fragment it doesn't show the fragments in view pager then I have to either change the orientation of the phone or keep swiping the viewpager for the hidden fragments to show. I have googled it and now I know I have to set the tag to each fragment and retrieve fragment with findfragmentbytag method but

OptionsMenu of Nested Fragments within ViewPager

梦想的初衷 提交于 2020-01-03 11:02:07
问题 I am using ActionBarSherlock and I am trying to implement a nested fragment structure with a viewpager. I have an activity which contains some views and a wrapper fragmet (FragmentA) This FragmentA contains a view pager which shows FragmentA.1, FragmentA.2 ,FragmentA.3. By Default, onCreateOptionsMenu events are not dispatched to child fragments as it is discussed here. So I am using this solution to overcome the issue. It works great over API level 17, but for below it does not show the

How can I make work ViewPager with RecyclerView inside NestedScrollView

寵の児 提交于 2020-01-03 08:32:13
问题 I am using NestedScrollView with ViewPager. NestedScrollView has a LinearLayout inside with some TextViews, TabLayout and ViewPager at the end. TextViews occupy most of the space and for ViewPager left a little space. ViewPager using two fragments, in one of them there is a few TextViews and ImageViews and in another fragment there is a RecyclerView. When I set ViewPager's height to WRAP_CONTENT it takes only space that left and I can't scroll to see the rest of the first fragment, and the