android:ime渲染问题

时间:2015-12-26 17:00:54

标签: java android xml android-edittext ime

我在使用Google的登录模板时出错。我使用登录活动,但我总是在渲染/设计屏幕中出现以下错误:

The following classes could not be found:
- EditText (Fix Build Path)
Tip: Try to build the project.

问题是由android:imeActionId xml-methods引起的。这是我的(谷歌)代码:

<EditText
                android:id="@+id/password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/prompt_password"
                android:imeActionId="@+id/login"
                android:imeActionLabel="@string/action_sign_in_short"
                android:imeOptions="actionUnspecified"
                android:inputType="textPassword"
                android:maxLines="1"
                android:singleLine="true" />

如果我删除所有android:ime [...]行,它的渲染效果非常好。 我使用Android Studio 1.5.1和compileSdkVersion 21

我希望你能帮我解决这个问题!

干杯!

1 个答案:

答案 0 :(得分:1)

这是由于android:imeActionId行的误导名称。

它的初始值"@+id/login"表示它正在设置自己的id值,而是期望你分配一个。

请查看Why does setting imeActionId with a predefined ID resource create an error?

它提供了一个对我有用的解决方案。

相关问题