Category : android-viewpager2

i am working with single activity and MVVM artitechture its have main activity for just launcher then there is the MainFragment from there we go to ViewPagerContainerFragment using navigation component and in that fragment i have viewpager2 setup with tablayout and in each fragment of viewpager2 there is recyclerview which need to load data from ..

Read more

I use viewpager2 and i need isUserInputEnabled be false. its work good when orientation is HORIZONTAL but when orientation is VERTICAL i should swipe left or right to viewpager scroll. resourcePager.adapter = adapter resourcePager.isUserInputEnabled = false resourcePager.orientation = ViewPager2.ORIENTATION_VERTICAL I want when swipe up or down viewpager scroll How i fix this problem?! Source: Android ..

Read more

Here is the situation : I have a main fragment, say HomeFragment. In that fragment I use a ViewPager2 with a FragmentStateAdapter I have two differents fragment instanciated by the adapter Issue : When I continue navigation and I come back to HomeFragment, the app crashes with the error java.lang.IllegalStateException: Fragment no longer exists for ..

Read more

I have a fragment called CharacterFragment which contains a viewpager with tablayout having 2 fragments. The Idea is to have a single viewmodel for the characterfragment and make the fragments from viewpager use it to get the data. I am using hilt for injecting the viewmodel. In the first section (about section) I am not ..

Read more

Viewpager2 currently has little references in StackOverflow, this question has not answered yet. I make ZoomActivity with ViewPager2. When i clicked image on first index/position, this code work fine, meanwhile i clicked second index it will show like below: Activity onCreate(savedInstanceState: Bundle?){ view_pager.adapter = ZoomImageAdapter(this, images) view_pager.offscreenPageLimit = images.size // get index of image val ..

Read more

I am working in a image and video slider. Helped me by Mr.ADM, I can load my images and videos in a viewpager 2. but now, images are working correct, but during sliding video will only be appeared sometimes..otherwise next image takes its place..what is wrong ? Please..i am newbie here.. public void onBindViewHolder(@NonNull final ..

Read more

I am creating a image and video slider using viewpager2. I used recyclerviewadapter for this. My code is below. The bitmaps from file loaded to imageview correctly. but linearlayout.addview shows repeated images only. Why those images are repeating..please help..My recylerview adapter class is given below..Whats wrong with this public SlideViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) ..

Read more

i have specific xml fragment_page.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <fragment tools:layout="@layout/fragment_user_info" android:name="com.example.b_my_friend.ui.page.UserInfoFragment" android:id="@+id/user_info" android:layout_width="match_parent" android:layout_height="@dimen/half_screen" /> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true"> <fragment android:id="@+id/feed" android:name="com.example.b_my_friend.ui.page.FeedFragment" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_marginTop="@dimen/half_screen" tools:layout="@layout/fragment_feed" /> </ScrollView> </FrameLayout> it looks like this and when i scroll down lower part(TabLayout and Viewpager) covered the entire screen and second xml with ViewPager2 fragment_feed.xml ..

Read more

I need two horizontal ViewPager2 two allow for nested scrolling. I searched a lot and I also found the official documentation for ViewPager2 and how nested scrolling can work. The thing is, that thesolution involves the scrollable element to be the only child like this <androidx.viewpager2.integration.testapp.NestedScrollableHost android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="8dp"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/first_rv" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#FFFFFF" /> ..

Read more