在Android中,你可以使用FrameLayout或RelativeLayout来放置EditText控件在TextView上方。下面是一个示例代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    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!"
        android:textSize="24sp"
        android:layout_centerInParent="true"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/textview"
        android:layout_marginTop="8dp"
        android:hint="Enter something..."/>

</RelativeLayout>

这个示例中,我们使用RelativeLayout作为根布局,并在其中放置了一个TextView和一个EditText。EditText被设置为在TextView的下方,并使用android:layout_below="@id/textview"属性来实现。

希望对你有所帮助

android中edittext控件怎么放置在TEXTVIEW上

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

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