繁体   English   中英

Xamarin Android支持设计库不可用

[英]Xamarin Android Support Design Library Not Available

我已经在Visual Studio中使用NuGet添加了Xamarin Android支持设计库(及其所有依赖项),但是当我在AXML代码中使用组件时,它说这是无效的子元素。 从我能找到的所有文档和示例中,除了通过NuGet添加软件包外,似乎不需要做任何额外的事情。 我可以在解决方案资源管理器的“引用”文件夹中看到所有库。

我确定我缺少了一件非常简单的事情,但是我找不到错误所在。 任何帮助,将不胜感激。 谢谢!

<?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#代码访问这些库。

检查文档中的TextInputLayouthttps : //developer.android.com/reference/android/support/design/widget/TextInputLayout.html

它说:

提供了TextInputEditText类,以用作此布局的子级。 使用TextInputEditText可以使TextInputLayout更好地控制任何文本输入的视觉效果。 用法示例如下:

<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>

因此,似乎您需要使用支持库中的EditText ,例如android.support.design.widget.TextInputEditText

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM