在我的 android xml 布局中编写 EditText 时,我遇到了一个新错误。布局的代码是:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dip" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Full Name"
android:textColor="#372c24" />
<EditText
android:id="@+id/reg_fullname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:imeOptions="actionNext" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Email:"
android:textColor="#372c24" />
**<EditText
android:id="@+id/reg_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_marginTop="5dip"
android:imeOptions="actionNext" />**
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Password"
android:textColor="#372c24" />
**<EditText
android:id="@+id/reg_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:imeOptions="actionDone" />**
<Button
android:id="@+id/saveBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:imeOptions="actionSend"
android:text="LOGIN" />
</LinearLayout>
错误跟踪是:
Caused by: android.view.InflateException: Binary XML file line #72: Error inflating class android.widget.EditText
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.createView(LayoutInflater.java:596)
04-23 09:11:56.109: E/AndroidRuntime(1692): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:644)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:669)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
04-23 09:11:56.109: E/AndroidRuntime(1692): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:224)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.app.Activity.setContentView(Activity.java:1777)
04-23 09:11:56.109: E/AndroidRuntime(1692): at com.bearing.inhouse.DashboardActivity.onCreate(DashboardActivity.java:38)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
04-23 09:11:56.109: E/AndroidRuntime(1692): ... 11 more
04-23 09:11:56.109: E/AndroidRuntime(1692): Caused by: java.lang.reflect.InvocationTargetException
04-23 09:11:56.109: E/AndroidRuntime(1692): at java.lang.reflect.Constructor.constructNative(Native Method)
04-23 09:11:56.109: E/AndroidRuntime(1692): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.view.LayoutInflater.createView(LayoutInflater.java:576)
04-23 09:11:56.109: E/AndroidRuntime(1692): ... 27 more
04-23 09:11:56.109: E/AndroidRuntime(1692): Caused by: java.lang.IllegalArgumentException: EditText cannot use the ellipsize mode TextUtils.TruncateAt.MARQUEE
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.widget.EditText.setEllipsize(EditText.java:112)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.widget.TextView.<init>(TextView.java:946)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.widget.EditText.<init>(EditText.java:58)
04-23 09:11:56.109: E/AndroidRuntime(1692): at android.widget.EditText.<init>(EditText.java:54)
04-23 09:11:56.109: E/AndroidRuntime(1692): ... 30 more
我以前使用过 EditText,但从未收到此错误。我从错误日志中不明白我应该做什么。你之前在代码中发现过这个错误吗?谢谢你。