1

I'm working on an Android Xamarin project for which I need to use android.support.v4.widget.NestedScrollView. I have a view which I am inflating via LayoutInflator.Inflate but the type returned is of type FrameLayout, not Android.Support.V4.Widget.NestedScrollView, which means I can't cast it to the correct type and access the ScrollView methods like SmoothScrollTo.

The ToString of the inflated view is android.support.v4.widget.NestedScrollView{27428a48 VFED.... .......D 1080,0-2160,1551} so I know at some level the correct view is being created.

Am I doing something wrong? Could this be a Xamarin bug?

Snippet of view XML as requested:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

..snip..

</android.support.v4.widget.NestedScrollView>

View inflation code:

view = (Android.Support.V4.Widget.NestedScrollView)mLayoutInflator.Inflate(Resource.Layout.view_registrationstep2, null);//InvalidCastException
Ian Newson
  • 7,679
  • 2
  • 47
  • 80

0 Answers0