[英]EditText doesn't show cursor or soft keyboard
I am trying to make a simple Hello World app with an EditText, but the EditText shows neither a cursor nor a soft keyboard when I click it. 我正在尝试使用EditText创建一个简单的Hello World应用程序,但是当我单击它时,EditText既不显示光标也不显示软键盘。 There is no way to enter any text.
无法输入任何文字。 I am getting the same problem in both the emulator and on my Galaxy Nexus device.
我在模拟器和Galaxy Nexus设备上都遇到了同样的问题。
Here is my activity_main.xml layout file: 这是我的activity_main.xml布局文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<EditText
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:inputType="text" >
</EditText>
</LinearLayout>
I don't have anything special in my Activity's OnCreate() method: 我的Activity的OnCreate()方法中没有任何特殊内容:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
What am I missing? 我错过了什么?
The OP had the following solution as an edit inside the question (and I'm just moving it to the proper place, as expected ): OP有一个以下解决方案作为问题内部的编辑(我只是按照预期将其移动到正确的位置):
Removing the line 删除线
android:background="@android:color/transparent"
as suggested by meh's comment fixed the problem. 正如meh的评论所暗示的那样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.