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. There is no way to enter any text. I am getting the same problem in both the emulator and on my Galaxy Nexus device.
Here is my activity_main.xml layout file:
<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:
@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 ):
Removing the line
android:background="@android:color/transparent"
as suggested by meh's comment fixed the problem.
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.