Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 81910

cannot convert from 'Android.Widget.TextView' to 'Xamarin.Forms.View'

$
0
0

Hi everybody,
I have a problem with "embedding native controls".

I followed this example https://developer.xamarin.com/samples/xamarin-forms/UserInterface/NativeEmbedding/ to embed a native android textview in my Xamarin.Forms.Page, but I have the error in thread title...

this is the code:

StackLayout layout = new StackLayout();

if ANDROID

        //var abc = new AndroidBarChart(Forms.Context);
        //layout.Children.Add(abc);

        var textView = new TextView (Forms.Context) { Text = "", TextSize = 14 };
        textView.SetSingleLine (false);
        textView.SetLines (3);
        layout.Children.Add(textView);

endif

        layout.Children.Add(listView);
        Content = layout;

the error is generated at this instruction: layout.Children.Add(textView);

any idea?

Thanks

Gianluca


Viewing all articles
Browse latest Browse all 81910

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>