viewpager

ViewPager not working if set layout_height = wrap_content

匿名 (未验证) 提交于 2019-12-03 08:42:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I got issues when worked with ViewPaper . It doesn't show anything when I set ViewPaper's height = wrap_content and it shows if I set height for ViewPager (ex: android:layout_height= "350dp" ). Please help! Thanks! This is my xml code: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:orientation="vertical" > <ScrollView android:id="@+id/scrollView" android:layout

ViewPage Fragment disappear when reload again

匿名 (未验证) 提交于 2019-12-03 07:36:14
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The following is layout test.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Click" android:id="@+id/button" /> <!-- Framelayout to display Fragments --> <FrameLayout android:id="@+id/frame_container" android:layout_width="match_parent" android:layout_height="match_parent" /> <

ViewPager on a view added by WindowManager getting “java.lang.IllegalArgumentException: No view found for id”

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am implementing a photo viewer which allow user to view photos in full-screen mode from a thumbnail. My current approach is adding inflated view to WindowManager . In the inflated view, there is a ViewPager allowing user switch images. And I got error "java.lang.IllegalArgumentException: No view found for id" Here is the details (a view is inflated in setActivity method and setting adapter for viewPager in openPhoto method): public class PhotoViewer { private static final String TAG = "PhotoViewer"; private Activity parentActivity; private

Android when ViewPager insert as Child get error android.view.ViewGroup.jumpDrawablesToCurrentState(ViewGroup.java:5035)

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have layout with child (NOT as root) element RelativeLayout and then i create ViewPager and insert it as child of my Relative layout, so it's like +Relative Layout (root) | +-- Relative Layout (child) | +-- -- ViewPager For now moment - all ok. But then i try add some view item to ViewPager with own layout then i got error 10-12 15:32:46.777: E/AndroidRuntime(6031): FATAL EXCEPTION: main 10-12 15:32:46.777: E/AndroidRuntime(6031): java.lang.StackOverflowError 10-12 15:32:46.777: E/AndroidRuntime(6031): at android.view.ViewGroup

Android app crashing after a while using Fragments and ViewPager

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've got a problem with my android app crashing when trying to restore my fragments. I have not added any custom variables to the bundle that I'm trying to restore, It's all default. I'm using Fragments and ViewPager. See my code snippets below: public static class MyAdapter extends FragmentStatePagerAdapter { public MyAdapter(FragmentManager fm) { super(fm); } @Override public int getCount() { return NUM_ITEMS; } public int getCurrentItemPosition(Fragment fragment){ return getItemPosition(fragment); } @Override public Fragment getItem(int

BadParcelableException:ClassNotFoundException when unmarshalling: android.support.v4.app.FragmentManagerState

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've migrated to SDK Android 27.1.0 3 days ago, and there are some crashs like this one, I can't understand why. It appears (currently) on Android 8 and 6. BadParcelableException ClassNotFoundException when unmarshalling: android.support.v4.app.FragmentManagerState android.support.v4.app.Fragment.setUserVisibleHint android.os.Parcel.readParcelableCreator (Parcel.java:2916) android.os.Parcel.readParcelable (Parcel.java:2842) android.os.Parcel.readValue (Parcel.java:2745) android.os.Parcel.readArrayMapInternal (Parcel.java:3114) android.os

ViewPager inside ScrollView - vertical scroll doesn&#039;t work

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So, I have this ScrollView with one child - a LinearLayout that has two children: a TextView and a ViewPager . ViewPager contains layout with many elements, that's why i need the ability to scroll vertically. Only pages in ViewPager may be scrolled horizontally (that is: I'd like to swipe horizontally only within the ViewPager ). That one TextView must not scroll horizontally but should scroll together with my ViewPager . Simple? No. I've seen extremely similar issues at StackOverflow popping up ( here , here and here and here ). None of the

IllegalStateException: The application&#039;s PagerAdapter changed the adapter&#039;s content without calling PagerAdapter#notifyDataSetChanged

匿名 (未验证) 提交于 2019-12-03 02:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using the ViewPager example with ActionBar tabs taken from the Android documentation here . Unfortunately, as soon as I call the addTab method, the application crashes with the following exception: IllegalStateException: The application's PagerAdapter changed the adapter's content without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count 0, found 1. This is the FragmentPagerAdapter code: public static class TabsAdapter extends FragmentPagerAdapter implements ActionBar.TabListener, ViewPager.OnPageChangeListener {

Android - Remove then add fragment from ViewPager?

匿名 (未验证) 提交于 2019-12-03 02:43:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a ViewPager with two page how can I remove one of Fragment from ViewPager and add another Fragment to ViewPager ? I wrote below code but doesn't work : public class MainActivity extends AppCompatActivity implements WorkTableFragment.listenerLogin { @BindView(R.id.tabsMainActivity) TabLayout tabsMainActivity; @BindView(R.id.viewpagerMainActivity) ViewPager viewPagerMainActivity; private ViewPagerAdapter adapter; @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R

How to Scroll ViewPager?

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am new to Android.How to use ViewPager.scrollBy(int x,int y) ? ViewPager.scrollBy(int x,int y) is not updating View new Handler().post(new Runnable() { @Override public void run() { // TODO Auto-generated method stub mainPager.scrollBy(10,0); } }); even this is not updating View. please tell me what is the difference between scrollTo(int x,int y) and scrollBy(int x,int y); 回答1: From what I understand scrollTo() and scrollBy() are not applicable to ViewPager ; they're just methods defined by View that do not apply to ViewPager . If you're