android-viewpager

Testing ViewPager with Espresso. How perfom action to a button of an Item?

不问归期 提交于 2019-12-18 10:42:08
问题 I have a ViewPager whith items containing only a picture and a button. I can't successfully interact with the UI of an item (Page) because, except the displayed picture, there is nothing to differentiate (from UI point of view) all items of the ViewPager . I tried to select only one item with a position: onData(is(instanceOf(ItemClass.class))) .atPosition(0) .onChildView(withId(R.id.button)) .perform(click()); causing: NoMatchingViewException: No views in hierarchy found matching: is

(ActionBar) Tabs + Pager + detail Fragments inside ViewPager container

冷暖自知 提交于 2019-12-18 10:24:41
问题 For ActionBarSherlock I would like to have (Action Bar) Tabs + Pager. I use Fragments inside that pager container. I already got the examples of http://actionbarsherlock.com/ working, but I can't manage to get a details fragment inside that pager container when I would click on let's say a listitem in the first fragment. Is it impossible to have something like this: Activity with Tabs and pager container Fragment A inside pager container under Tab1 Click on something in Fragment A and show

ViewPager Fragments getting destroyed over time?

对着背影说爱祢 提交于 2019-12-18 10:24:33
问题 I am using Android's support.v4 package to develop a ViewPager containing multiple Fragment s. I am trying to hide the Views when the user changes page. So, I implemented an OnPageChangeListener to listen to my adapter, and call an update() method in my Fragment s when when a page change occurs. But I'm getting a NullPointerException , and I cannot figure out why. Here is the code: public class MyActivity extends FragmentActivity implements OnPageChangeListener { private static final int NUM

onPageSelected isn't triggered when calling setCurrentItem(0)

China☆狼群 提交于 2019-12-18 10:00:29
问题 I have an Activity with a ViewPager which displays a bunch of pictures. When it starts the ViewPager's position is set based on what the user selected in a previous Activity. Similar to a gallery. I want the onPageSelected to be called every time a new page is selected, i.e. when the Activity is first opened or when the user slides to a new page. I set the starting point like so: mPager.setCurrentItem(index); Everything works, except when setCurrentItem called with index set to 0 as this will

how to make ViewPager and gridview scroll vertical at a same time

馋奶兔 提交于 2019-12-18 09:46:05
问题 I have ViewPager and grid view in my activity.i want when I scroll anywhere on screen both ViewPager and grid view should scroll at a same time.here is my ss :image.now the only few images are displayed in grid view I have 63 images but shows only 9 in grid..2)ss main xml: <?xml version="1.0" encoding="utf-8"?> <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas

View Pager with previous and next item smaller in size with infinite scroll

家住魔仙堡 提交于 2019-12-18 09:15:09
问题 Want to create the view pager same as following UI, applied custom transformer but not working. ViewPager.java public class MyViewPager extends ViewPager implements ViewPager.PageTransformer { public static final String TAG = "MyViewPager"; private float MAX_SCALE = 0.0f; private int mPageMargin; private boolean animationEnabled=true; private boolean fadeEnabled=false; private float fadeFactor=0.5f; public MyViewPager(Context context) { this(context, null); } public MyViewPager(Context

Data Persistence ViewPager

走远了吗. 提交于 2019-12-18 08:58:29
问题 I am using ViewPager to show the multiple views of the form, like name and email on first view and rest on others. Now the problem is: Enter Data on page 1 navigate to page 2 and then to page 3. come back to page 1 the data is not there. I have a save button on the last page so I also need a way to retrieve the data from other pages there. If I can get a way I can save the data on page 1 when it is changed to page 2 like onDestroy method on activity. Is ViewPager inappropriate for my purpose

How to intercept touch events from ViewPager.OnPageChangeListener

落花浮王杯 提交于 2019-12-18 08:10:22
问题 I'm trying to disallow my ViewPager from scrolling between tabs. I have the following situation: public class MyClass extends ViewPager implements ViewPager.OnPageChangeListener, OnTouchListener { public MyClass() { setOnTouchListener(this); } @Override public void onPageScrollStateChanged(int state) { Log.d("Testing", TAG + " onPageScrollStateChanged"); } @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { Log.d("Testing", TAG + "

Android show SearchView result ListView above ViewPager

三世轮回 提交于 2019-12-18 07:24:22
问题 Hi i want to search users in my app via SearchView widget. I want to show suggested users name in a ListView above a ViewPager of same XML layout when SearchWidget is active. I used following xml <?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ListView android:id="@+id/searched_friends_list" android:layout_width="fill_parent" android:layout_height="wrap

Android ViewPager w/ multiple Fragment classes each w/ separate layout file

主宰稳场 提交于 2019-12-18 06:56:20
问题 My app uses the android.support.v4.view.ViewPager class. For each page in the ViewPager, I want there to be one Fragment, each with its own layout file. Each Fragment is defined in its own file. I am having a hard time implementing this. To clarify, there is: 1 ViewPager 4 Fragment Files - FragmentOne.class, FragmentTwo.class, FragmentThree.class, FragmentFour.class 4 XML Layout Files - frag_one.xml, frag_two.xml, frag_three.xml, frag_four.xml The examples that I have seen only deal with one