Reputation: 1
I have added the Xamarin Android Support Design Library (and all of its dependencies) using NuGet in Visual Studio, but when I go to use a component in my AXML code it says it is an invalid child element. From all the documentation and examples I could find, it doesn't seem like anything extra needs to be done other than adding the package via NuGet. I can see all of the libraries in the References folder in the Solution Explorer.
I'm sure I'm missing something incredibly simple, but I cannot find what is wrong. Any help would be appreciated. Thanks!
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:p1="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
p1:orientation="vertical"
p1:layout_width="match_parent"
p1:layout_height="match_parent">
<ImageView
p1:src="@drawable/boxlogo"
p1:layout_width="match_parent"
p1:layout_height="wrap_content"
p1:id="@+id/boxLogo" />
<android.support.design.widget.TextInputLayout
p1:layout_width="match_parent"
p1:layout_height="wrap_content">
<EditText
p1:layout_width="match_parent"
p1:layout_height="wrap_content"
p1:id="@+id/sku"
p1:hint="@string/sku" />
</android.support.design.widget.TextInputLayout>
...
</LinearLayout>
I get the error on the tag with android.support.design.widget.TextInputLayout
I am able to access the libraries in my C# code.
Upvotes: 0
Views: 961
Reputation: 6088
Check the docs for TextInputLayout
:
https://developer.android.com/reference/android/support/design/widget/TextInputLayout.html
It says:
The TextInputEditText class is provided to be used as a child of this layout. Using TextInputEditText allows TextInputLayout greater control over the visual aspects of any text input. An example usage is as so:
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/form_username"/>
</android.support.design.widget.TextInputLayout>
So it seems you need to use an EditText
from the support library, e.g. android.support.design.widget.TextInputEditText
Upvotes: 0