[英]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#代碼訪問這些庫。
檢查文檔中的TextInputLayout
: https : //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.