在Android中,可以使用FrameLayout布局来实现将EditText控件叠加在TextView上。以下是一个示例代码:

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/textview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!" />

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="top|start"
        android:background="@null" />

</FrameLayout>

在这个示例中,FrameLayout作为父容器,将TextView和EditText作为子控件添加进去。EditText的android:layout_gravity="top|start"属性指定了EditText应该叠加在TextView的顶部和起始位置(左上角)。

需要注意的是,为了使EditText的背景透明,可以使用android:background="@null"来设置背景为透明。这样,EditText就会显示为透明的文本框,叠加在TextView上面

android中edittext控件怎么叠加在TEXTVIEW上

原文地址: https://www.cveoy.top/t/topic/hLat 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录