Android-如何使用覆盖视图屏蔽EditView
我正在尝试用另一个视图覆盖EditText。我的布局似乎正常,但编辑文本仍然可以单击。我错过了什么 这是我的基本布局:Android-如何使用覆盖视图屏蔽EditView,android,mobile,layout,user-interface,android-edittext,Android,Mobile,Layout,User Interface,Android Edittext,我正在尝试用另一个视图覆盖EditText。我的布局似乎正常,但编辑文本仍然可以单击。我错过了什么 这是我的基本布局: 这是emulator视图: 更新: 我正在为线性布局设置动画,以显示或隐藏编辑文本,只需将android:clickable=“true”放入LinearLayout这个问题你必须更清楚。我不确定完全覆盖你的“编辑文本”到底有什么意义。如果要禁用“EditText”,可以使用“.setEnabled()”方法并将其传递为“false”。尝试以下操作: <Relat
这是emulator视图:
更新:
我正在为线性布局设置动画,以显示或隐藏编辑文本,只需将
android:clickable=“true”
放入LinearLayout
这个问题你必须更清楚。我不确定完全覆盖你的“编辑文本”到底有什么意义。如果要禁用“EditText”,可以使用“.setEnabled()”方法并将其传递为“false”。尝试以下操作:
<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>
不清楚您到底想要什么。是否要隐藏EditText
而无法单击它?然后不要编写EditText
code.add android:clickable=“false”,为什么需要它?我正在设置线性布局的动画以显示或隐藏text@Shlomi施瓦茨请尝试我的答案,这样edittext就不能使用ClickThank了!这正是我所需要的:)谢谢你的回复,但这将编辑文本置于我的线性布局之上
<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>