2017-01-18 14 views
0

Visual StudioでNuGetを使用してXamarin Android Support Design Library(およびそのすべての依存関係)を追加しましたが、AXMLコードでコンポーネントを使用すると、無効です子要素。私が見つけることができたすべてのドキュメンテーションとサンプルから、NuGet経由でパッケージを追加する以外に何か追加の必要がないように思えます。ソリューションエクスプローラのReferencesフォルダにあるすべてのライブラリを見ることができます。XamarinのAndroidサポートデザインライブラリが利用できません

私は信じられないほどシンプルなものを見逃していると確信していますが、間違っているものは見つかりません。どんな助けもありがとう。ありがとう!

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

私は私のC#コードでライブラリにアクセスできるようにしていますandroid.support.design.widget.TextInputLayout

とタグのエラーを取得します。

+1

どのようなエラーがありますか? EditTextの代わりに[TextInputEditText](https://developer.android.com/reference/android/support/design/widget/TextInputEditText.html)を使用する必要がありますか? –

+0

"要素 'LinearLayout'に無効な子要素があります。 'android.support.design.widget.TextInputLayout'"は私が得るエラーです。 Xamarin Blogは、 'EditText'(https://blog.xamarin.com/add-beautiful-material-design-with-the-android-support-design-library/)の例を示していますが、 'android.support .design.widget.TextInputEditText 'は動作しません。 –

答えて

0

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

+0

アレックスは正確なエラーメッセージを書きませんでしたが、記述から私は彼が私が得たものと同じになると思います: "要素 'LinearLayout'に無効な子要素 'android.support.design.widget.TextInputLayout'"があります。私はTextInputEditTextを使用しており、違いはありません。 –

関連する問題