Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android app in Eclipse: Edit text not showing on Graphical layout

I am trying to add a text field onto my Android app in Eclipse, but then I drag the Plain text option on to the graphical layout, a message at the bottom comes up. It reads Exception raised during rendering: java.lang.System.arraycopy([CI[CII)V Exception details are logged in Window > Show View > Error Log Even when I go to Window > Show View there is no error log option. The whole designer is useless now, because I can not use it anymore until I delete the EditText directly from the xml. What is causing this error, and how do I fix it? I am running the latest version (as of today, 6-30-14), and Windows 8 Pro x64.

Here is my full layout code:

<RelativeLayout 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" tools:context="${relativePackage}.${activityClass}" >  <TextView     android:id="@+id/textView1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignParentTop="true"     android:layout_centerHorizontal="true"     android:layout_marginTop="18dp"     android:text="@string/welcome_text" />  <EditText     android:id="@+id/editText1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_centerHorizontal="true"     android:layout_centerVertical="true"     android:ems="10"     android:inputType="text">      <requestFocus /> </EditText>  </RelativeLayout> 
like image 273
AJDev Avatar asked Jul 01 '14 00:07

AJDev


People also ask

How do you add edit text to the Android application?

Step 1: Create a new project in Android Studio and name it EditTextExample. Step 2: Now Open res -> layout -> xml (or) activity_main. xml and add following code. In this code we have added multiple edittext and a button with onclick functionality.

How do I change the style of edit text in Android Studio?

You can use the attribute style="@style/your_style" that is defined for any widget. The attribute parent="@android:style/Widget. EditText" is important because it will ensure that the style being defined extends the basic Android EditText style, thus only properties different from the default style need to be defined.


2 Answers

Check the "Android version to use when rendering layouts" and make sure you're not using a version that ends in "W" for Android Wear (e.g. API 20: Android 4.4W). I don't believe Wear supports EditText.

In both Android Studio and Eclipse, it's the dropdown with the green android in the layout preview's toolbar. You may want to set it explicitly and not allow the IDE to choose the Android version automatically.

like image 114
Fabian Avatar answered Sep 25 '22 16:09

Fabian


From the Eclipse IDE, just change the API version to use for previewing, as shown in below screenshot. Instead of "Automatically Pick Best", manually select the one which works for you (API 17 worked for me).

enter image description here

like image 21
Jim C Avatar answered Sep 26 '22 16:09

Jim C