Reputation: 3
Error Rendering in TextInputLayout in API 21 in studio. However it is working perfect in API level 23. In real time working perfect on both
The following classes could not be instantiated:
- android.support.design.widget.TextInputEditText (Open Class, Show Exception, Clear Cache)
- android.support.design.widget.TextInputLayout (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
Exception Details java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:658) at com.android.internal.util.XmlUtils_Delegate.convertValueToInt(XmlUtils_Delegate.java:47) at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:88) at android.content.res.BridgeTypedArray.getInt(BridgeTypedArray.java:204) at android.widget.TextView.<init>(TextView.java:1051) at android.widget.EditText.<init>(EditText.java:65) at android.widget.EditText.<init>(EditText.java:61) at android.support.v7.widget.AppCompatEditText.<init>(AppCompatEditText.java:62) at android.support.v7.widget.AppCompatEditText.<init>(AppCompatEditText.java:58) at android.support.design.widget.TextInputEditText.<init>(TextInputEditText.java:39) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:809) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
I am just taking basic details of a person in this . For which I have used various EditText....................................................................................................................................
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/background_first">
<LinearLayout
android:id="@+id/update_details_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="30sp"
android:text="@string/u_fields"
android:padding="10dp"
android:textColor="@color/navy_blue"
android:textAlignment="center"
android:textStyle="bold"/>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="@color/navy_blue"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:padding="10dp"
android:textColor="@color/black"
android:text="@string/u_fields_text1"
android:layout_marginTop="7dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:theme="@style/Widget.Design.TextInputLayout"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.EditText
android:id="@+id/update_first_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/first_name_hint"
android:inputType="textCapCharacters"
android:imeActionId="@+id/update_first_name_action"
android:imeOptions="actionNext"
android:maxLength="20"
android:maxLines="1"
android:singleLine="true" />
<requestFocus/>
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.1">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.EditText
android:id="@+id/update_last_name"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:hint="@string/last_name_hint"
android:imeActionId="@+id/update_last_name_action"
android:imeOptions="actionNext"
android:inputType="textCapCharacters"
android:maxLines="1"
android:maxLength="15"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</LinearLayout>
<Button
android:id="@+id/update_button"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/done"
android:textColor="@color/black"
android:layout_margin="7dp"
android:textStyle="bold" />
</LinearLayout>
</FrameLayout>
Upvotes: 0
Views: 1049
Reputation: 1988
RisingSun for your information the TextInputEditText is added in version 23.2.0 hence it can not support below 23.2.0 version..
for more follow this link
https://developer.android.com/reference/android/support/design/widget/TextInputEditText.html
Upvotes: 1