I've create a content page inside tabbed page and In the content page i Get videos list from server and show in media element inside list view. All working fine but i want to show videos in view pager for slide videos one by one. Thanks in advance.
Asked
Active
Viewed 119 times
-1
-
1I have voted to close your question as you haven't shown any attempt in solving the issue your self. Nor are you presenting your findings and debug information. Please refer to https://stackoverflow.com/help/how-to-ask on how to ask good questions that won't get closed. StackOverflow is not a forum where you ask a random question and get people to deliver silver platter solutions for you. Do your own work first. – Cheesebaron Aug 31 '20 at 06:07
1 Answers
0
Add below Namespaces
using Android.Support.V4.View;
using Android.Support.V7.App;
using Android.Support.Design.Widget;
using V4Fragment = Android.Support.V4.App.Fragment;
using V4FragmentManager = Android.Support.V4.App.FragmentManager;
using System.Collections.Generic;
using V7Toolbar = Android.Support.V7.Widget.Toolbar;
Now, we need to create ViewPager variable and declare the viewpager within the OnCreate(). Before it, we need to change the Activity in AppCompatActivity.
//SupportActionBar
SetSupportActionBar(toolbar);
SupportActionBar.SetIcon(Resource.Drawable.Icon);
//ViewPager
viewpager = FindViewById < Android.Support.V4.View.ViewPager > (Resource.Id.viewpager);
var toolbar = FindViewById < V7Toolbar > (Resource.Id.toolbar);
setupViewPager(viewpager); //Calling SetupViewPager Method
//TabLayout
var tabLayout = FindViewById < TabLayout > (Resource.Id.tabs);
tabLayout.SetupWithViewPager(viewpager);
//FloatingActionButton
var fab = FindViewById < FloatingActionButton > (Resource.Id.fab);
fab.Click += (sender, e) => {
Snackbar.Make(fab, "Here's a snackbar!", Snackbar.LengthLong).SetAction("Action", v => Console.WriteLine("Action handler")).Show();
};
For more information follow this link https://www.c-sharpcorner.com/article/xamarin-android-create-viewpager-tablayout-floatingactionbutton-supportacti/

Makwana Prahlad
- 1,025
- 5
- 20