1

I'm trying to overlay EditText with another view. My Layout seems to work, however the EditText is still clickable. What am I missing?

Here is my basic layout:

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">

<EditText
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/editText"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:inputType="text"/>

<LinearLayout
        android:orientation="vertical"
        android:background="#00aa00"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true">
</LinearLayout>

and here is the emulator view:

enter image description here

Update: I'm animating the LinearLayout to show or hide the EditText

4

3 回答 3

3

刚放进 android:clickable="true"LinearLayout

于 2013-06-05T13:03:53.357 回答
0

你必须在这个问题上更清楚。我不确定完全覆盖你的“EditText”的意义是什么。如果您想禁用“EditText”,可以使用“.setEnabled()”方法并将其传递为“false”。

于 2013-06-05T13:05:14.907 回答
0

尝试这个:

<RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        xmlns:android="http://schemas.android.com/apk/res/android">

    <LinearLayout
            android:orientation="vertical"
            android:background="#00aa00"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true">
    </LinearLayout>

    <EditText
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:id="@+id/editText"
            android:layout_alignParentTop="true"
            android:layout_alignParentLeft="true"
            android:inputType="text"/>
    </RelativeLayout>
于 2013-06-05T13:06:00.777 回答