简体   繁体   中英

Text field not working in Android Studio

I am a beginner in android world, I just want to learn new things

My problem is that I am not able to insert 'Person Name' text field in the graphical layout.

I have inserted a large text field and changed the id after that when i am inserting person name field to the graphical layout a error pops up displaying

在此处输入图片说明 and when i install L-Preview, it is not able to install.

layout code before adding text field :-

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
android:orientation="vertical">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="Contact Creator"
    android:id="@+id/lblCreatorTitle"
    android:layout_marginTop="5dp"
    android:layout_gravity="center_horizontal" />

layout code after adding text field:-

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="Contact Creator"
    android:id="@+id/lblCreatorTitle"
    android:layout_marginTop="5dp"
    android:layout_gravity="center_horizontal" />

<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:inputType="textPersonName"
    android:text="Name"
    android:ems="10"
    android:id="@+id/editText"
    android:layout_gravity="center_horizontal" />

I am using android studio 0.8.14 and jdk1.8.0_25 and API 20 :Android 4.4W. Please Help, I am not familiar with many concepts in android as i am new to this.

Thanks in advance!

Please install and use the full release of API 21 instead; ignore what it says about L preview; that error message is old.

Though it's not clear from what the UI tells you, API 20 is only intended for developing Android Wear apps; by your screenshot, it looks like you're trying to build a phone application, so API 21 would be a better choice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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