Rendering problems using the new TextInputLayout for EditText

I am trying to install a new .desing support library that provides some visual effects of candy on older versions of Android.

In this case, I'm going to add floating labels for edittext that are executed using widget.TextInputLayout:

enter image description here

To do this, I followed Google with a few directions:

  • I downloaded the latest support library (22.2.0) and included graddle in the file.

    compile 'com.android.support:design:22.2.0'

  • I added TextInputLayout to my xml as follows:

<android.support.design.widget.TextInputLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="30dp" android:layout_marginLeft="20dp"> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="12" android:hint="hint" android:inputType="number" android:id="@+id/edt" /> </android.support.design.widget.TextInputLayout> 

But Android Studio shows this in a layout preview:

 Rendering failed with a known bug. Please try a rebuild. The following classes could not be instantiated: - android.support.design.widget.TextInputLayout (Open Class, Show Exception, Clear Cache) Exception Details java.lang.NoSuchFieldError: TextAppearance 

This is the style I use:

 <style name="MaterialTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/md_red_500</item> <item name="colorPrimaryDark">@color/darkPrimaryColor</item> <item name="colorAccent">@color/md_green_500</item> <item name="android:textColorPrimary">@color/md_grey_900</item> <item name="android:textColorSecondary">@color/md_grey_600</item> </style> 

EDIT-

enter image description here

+5
source share
1 answer

solved. Had to add this:

 <android.support.design.widget.TextInputLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="30dp" android:layout_marginLeft="20dp" app:hintTextAppearance="@style/TextAppearence.App.TextInputLayout"> 

If this is true:

 <style name="TextAppearence.App.TextInputLayout" parent="@android:style/TextAppearance"> <item name="android:textColor">@color/accentColor</item> </style> 
+10
source

All Articles