android-viewpager

Android: Get Fragment Reference from ViewPager/FragmentStatePagerAdapter

我怕爱的太早我们不能终老 提交于 2019-12-22 13:51:28
问题 Disclosure up front, this is a school project. I've been working on an activity in a project that consists of a series of dynamic action bar tabs and list fragments, and have been stuck on the prospect of getting object references to the specific tab fragments in order to set adapters for the list views. I have it set up at the moment using a ViewPager (the support v4 version) and a FragmentStatePagerAdapter (v13). I've tried methods mentioned in a few SO question threads, namely these three:

ViewPager and longclick

心不动则不痛 提交于 2019-12-22 12:41:24
问题 I have a layout that is over top of a viewpager. The viewpager is functioning as a dynamically changing background. Upon a long click of the viewpager (long clicking the background), the foreground elements should disappear. I put a long click listener on the viewpager, but it doesn't respond to this out of the box. This linked answer seems to touch on the subject, but I'm not sure how to implement it, help? https://stackoverflow.com/a/11303508/727429 I'm also experimenting with other UX

Dont allow viewpager load two page in the first time

☆樱花仙子☆ 提交于 2019-12-22 12:23:20
问题 At the moment, i have a viewpager,when page scroll,i have load api for get new information. But in the first load viewpager,progress loading display two twice because it load first page and next page. I only want to load the first page in viewpager. How must I do? 回答1: best way is to create one interface. and implement this interface to all fragment. e.g. public interface FragmentInterface { void fragmentBecameVisible(); } in ur viewpager activity put like this e.g viewPager

android ViewPager customizable

佐手、 提交于 2019-12-22 11:35:13
问题 I need to implement a scroll view as shown: That is, in "idle" state image "1" is visible in full size and image "2" is visible partially (thus giving a clue to the user that he can scroll the content). After scrolling scrool view must not stay in intermediate state and scrolling must be completed (like iOS's Scroll View does when "Paging Enabled" is turned on): I refused to use HorizontalScrollView , because it has nothing similar to "Paging Enabled" property. After googling, I came across

ViewPager + GridView onItemClick

六眼飞鱼酱① 提交于 2019-12-22 11:13:23
问题 I have a GridView inside a layout in a ViewPager (I'm not sure if that makes a difference). inside SampleAdapter for ViewPager{ @Override public Object instantiateItem(ViewGroup container, int position) { View page = null; if (position == 0) { page = getLayoutInflater().inflate(R.layout.layoutone, container, false); } else { page = getLayoutInflater().inflate(R.layout.layouttwo, container, false); GridView grid = (GridView) page.findViewById(R.id.gridview); grid.setOnItemClickListener(new

Android 5 screen glitch/static with Google Maps Fragment inside a Viewpager

◇◆丶佛笑我妖孽 提交于 2019-12-22 10:34:29
问题 I am having a strange issue related to Android 5 and Google Maps combined with a Viewpager and Fragments, hoping to get some good ideas from all of you.. Screenshot of the problem: http://postimg.org/image/6wzssbdbr/ (no rep for inlining yet) Situation: Main Activity with a Viewpager that has a number of Fragments One of the Fragments has a MapView inside it with all lifecycle methods forwarded; replace MapView with MapsFragment and the issue is the same Open a new Activity, as long as the

How can I animate a Fragment inside a viewpager?

一曲冷凌霜 提交于 2019-12-22 10:14:57
问题 I have got a viewpager that hosts two Fragments. Now I would like to replace one of the Fragments on a button click. How can I animate this replacement? (e.g. using the flip-card effect) Since it is difficult two put all my code in here, this is what I basically use http://developer.android.com/reference/android/support/v4/app/FragmentPagerAdapter.html 回答1: You can animate it using a PageTransformer Or, if you want the animation on replacing a fragment, you can set a custom animation on the

Reload or notify Fragment's data in ViewPager

China☆狼群 提交于 2019-12-22 10:00:11
问题 I have [main]Fragment with two ViewPagers in it. Each ViewPager contains several Fragments in it. ViewPager 's Fragments obtain data into their ListViews from [main]Fragment . I need to update data in all ListViews , which comes from [main]Fragment . I've tried to remove current [main]Fragment and add new one (reload it), but when I am calling .remove([main]Fragment) or .detach([main]Fragment) methods in .supportFragmentManager() [main]Fragment is not destroying or detaching, it just hiding

MediaController not swiping in ViewPager

落爺英雄遲暮 提交于 2019-12-22 09:36:42
问题 I'm using a ViewPager to show several Fragments provided by a FragmentPagerAdapter . One of these Fragments shows a VideoView and an according MediaController . The issue I'm facing is, that the MediaController is not swiping to the left/right as it's supposed to together with the rest of the Fragment . (Hopefully you can follow me ^^) I've looked through a lot of similar discussions on StackOverflow, but unfortunatly none of them fixes my issue. This is my xml for the Fragment that is

Android TabsAdapter with ActionbarSherlock

半腔热情 提交于 2019-12-22 08:39:10
问题 I am using ActionbarSherlock with a SherlockListFragment that implements LoaderManager.LoaderCallbacks . In my ApplicationActivity onCreate method I am using setContentView(R.layout.application); to set the layout -- works great. I am initializing the actionbar like so ActionBar bar = getSupportActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); bar.setDisplayHomeAsUpEnabled(false); bar.setDisplayShowTitleEnabled(true); /