Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

TextInputLayout not inflating

Hi folks

I am using Xamarin android with visual studio. I have the floating text working using the following

  1. Theme = Theme.AppCompat.Light.DarkActionBar
  2. <>
  3. MainActivity : AppCompatActivity
  4. using Android.Support.V7.App

What I can't get working is the following:

  1. Theme = android:Theme.Material
  2. <>
  3. MainActivity : Activity

I get the following error:
Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class

My understanding is that the Android.Support.V7.App is needed for API < 23. I am targetting 22+

Would be really grateful if anyone can explain why or can spot why it isn't working.

Many thanks



  • RofiqSetiawanRofiqSetiawan USMember ✭✭✭


    Please make sure you have installed Xamarin.Android.Support.Design nuget.

  • kal67kal67 Member

    Hi RofiqSetiawan

    Many thanks for your reply. Yes I have installed v25.4.02 of Xamarin.Android.Support.Design.

    If I show you what I have maybe you can spot what is needed. I'm sure it's something really trivial but I just can see what. I thought it might be a using statement so added using Android.Support.Design

    I can get it all to work if using AppCompat etc but I thought you only used AppCompat if you are targetting API < 22.


            using Android.App;
            using Android.Widget;
            using Android.OS;
            using Android.Support.Design;
            namespace FloatingTextMaterialDesignDemo
                [Activity(Label = "FloatingTextMaterialDesignDemo", MainLauncher = true)]
                public class MainActivity : Activity
                    protected override void OnCreate(Bundle savedInstanceState)
                        // Set our view from the "main" layout resource

    Unhandled Exception - happens on **SetContentView(Resource.Layout.Main);**

    Android.Views.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class occurred


                <LinearLayout xmlns:android=..."
                android:layout_height="wrap_content"  >
                    android:inputType="textPersonName|textCapWords" />


        <?xml version="1.0" encoding="utf-8" ?>
            <!-- Base theme 
        <style name="MyTheme" parent="android:Theme.Material">            
            <!-- colorPrimary is used for the default action bar background -->
            <item name="colorPrimary">#2196F3</item>
            <!-- colorPrimaryDark is used for the status bar -->
            <item name="colorPrimaryDark">#1976D2</item>
            <!-- colorAccent is used as the default value for colorControlActivated
                 which is used to tint widgets -->
            <item name="colorAccent">#FF4081</item>       
Sign In or Register to comment.