【发布时间】:2017-01-18 20:37:34
【问题描述】:
我在 Visual Studio 中使用 NuGet 添加了 Xamarin Android 支持设计库(及其所有依赖项),但是当我在 AXML 代码中使用组件时,它说它是无效的子元素。从我能找到的所有文档和示例中,除了通过 NuGet 添加包之外,似乎不需要做任何额外的事情。我可以在解决方案资源管理器的 References 文件夹中看到所有库。
我确定我遗漏了一些非常简单的东西,但我找不到问题所在。任何帮助,将不胜感激。谢谢!
<?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>
我收到android.support.design.widget.TextInputLayout标签上的错误
我能够访问我的 C# 代码中的库。
【问题讨论】:
-
什么错误?也许您应该使用TextInputEditText 而不是 EditText?
-
"元素 'LinearLayout' 的子元素 'android.support.design.widget.TextInputLayout'" 是我得到的错误,我认为这与 Alex 得到的错误相同。 Xamarin 博客给出了带有 'EditText' (blog.xamarin.com/…) 的示例,但即使使用 'android.support.design.widget.TextInputEditText' 它也不起作用。
标签: android xml visual-studio xamarin xamarin.android