json leader json leader -5 years ago 551
Android Question

Use SetOnTabSelectdListerner of TabLayout on Xamarin Android?

Error: can not create instance of abstract class or interface

tablayout.SetOnTabSelectedListener(new TabLayout.IOnTabSelectedListener()


Answer Source

Try this:

protected override void OnCreate(Bundle savedInstanceState)

    var tabLayout = FindViewById<TabLayout>(Resource.Id.tab);

    tabLayout.TabSelected += (object sender, TabLayout.TabSelectedEventArgs e) =>
        var tab = e.Tab;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download