android-viewpager

Controls behind statusbar with ViewPager & fitsSystemWindow

烈酒焚心 提交于 2019-12-22 01:29:37
问题 I have a ViewPager with Fragments which contain fullscreen images and some bottom aligned controls. I want to make sure the controls do not disappear behind the translucent navigation bar with fitsSystemWindow but I can't seem to make it work... It does work when I use the same xml without the ViewPager so it seems the ViewPager "breaks" the ability to use fitsSystemWindow . Code I have for the activity: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android

White screen in view pager fragment state pager adapter when we come back?

孤街醉人 提交于 2019-12-21 23:15:03
问题 I have used view pager for load fragments using FragmentStatePagerAdapter. when i will come first time it will working but if i am redirect to other fragment from pager adapter and come back it will display blank screen. **fragment_community.xml** <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android

Avoid ViewPager going under Toolbar

半腔热情 提交于 2019-12-21 23:02:08
问题 Based on this answer I tried to make a solution for my Use Case. Instead of using a Collapsing toolbar I'm using a regular one but with a TabLayout . However, for the TabLayout I need to use a ViewPager and I have no idea where to place it in order to avoid trouble with the FrameLayout . ViewPager was in my Host Fragment and when its layout replaced the FrameLayout, the content went below the Toolbar and TabLayout for some reason... I tried putting it below that line <include layout="@layout

Handling click events in ViewPager with negative page margin

非 Y 不嫁゛ 提交于 2019-12-21 22:21:11
问题 I have a ViewPager showing "cards" that the user can swipe between. The cards are created in their own fragments (so I am using a FragmentStatePagerAdapter to create the content for the ViewPager). I wanted to show the edge of the next and possibly previous cards, so as recommended on this site I set the pageMargin of the ViewPager to a negative number. This works well and looks just as I want it to. My problem is that I need to respond to click events on the cards. But using a negative

ViewPager in simple Dialog

江枫思渺然 提交于 2019-12-21 22:10:19
问题 I would like to use a ViewPager in a dialog but fail epicly! Here is all the code. There is two fragments to be shown in the dialog: Layouts main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Main" > <Button android:id="@+id/button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="dialog"

FragmentTabHost, Nested Fragments and ViewPager

别等时光非礼了梦想. 提交于 2019-12-21 21:41:57
问题 I have an activity which makes use of a FragmentTabHost , so each tab has a fragment inside it. In the first tab, I have 2 nested fragments, one on the top half of the screen, the other on the bottom half. The fragment on the bottom uses a ViewPager to scan through several LinearLayouts . It all works pretty well. Until you move to another tab, and return to the first. The bottom nested fragment no longer appears, but the one on top does. Here's some code demonstrating my usage: This is how I

Viewpager and listView on the same Activity

爷,独闯天下 提交于 2019-12-21 21:26:46
问题 I want to make an activity that contains a viewpager and listview below it which you can scroll them both .. like these apps ... anyone can help 回答1: Well I could do it with some way by measuring the height of the listView and adding the listview and the view pager into scroll view here's the sample I've made public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list); ViewPager

Is TabLayout supposed to replace PagerTabStrip? Is there any “pro” to PagerTabStrip?

懵懂的女人 提交于 2019-12-21 21:25:59
问题 OK, so I see PagerTabStrip has a bug - https://code.google.com/p/android/issues/detail?id=183127 Therefore, is TabLayout a better choice especially for now? Is there any downside to TabLayout? Some quirkiness where you might have to set all 3 items? I see TabLayout versus pagerTabStrip for convenience and functionality but that didn't really get answers... 来源: https://stackoverflow.com/questions/32770917/is-tablayout-supposed-to-replace-pagertabstrip-is-there-any-pro-to-pagertabst

Changing background image of current fragment in viewpager

可紊 提交于 2019-12-21 17:57:14
问题 I have 4 fragments in a viewpager. And FragmentStatePagerAdapter inside the activity where my viewpager is. FragmentStatePagerAdapter's newInstance() method takes as parameter layout id, therefore each fragment has it's own layout: ViewPager pager; public class MainActivity extends FragmentActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); pager = (ViewPager) findViewById(R.id.viewPager); pager

Why is Tablayout and Viewpager crashing with NullpointerException when I start a fragment with LoaderManager from TabFragment?

依然范特西╮ 提交于 2019-12-21 17:45:28
问题 I am following the tutorial of https://androidbelieve.com/navigation-drawer-with-swipe-tabs-using-design-support-library/ to implement sliding tablayout. It works perfect for empty fragments, However, I have 3 fragments with LoaderManagers and recyclerViews, each one loads different data. When the app loaded at the first time, if I click from the first fragment to the third fragment on the tabLayout without sliding or clicking to second one, it crashes. The data was not loading, as it