Android 如何创建此视图?

Android 如何创建此视图?,android,listview,view,android-custom-view,Android,Listview,View,Android Custom View,我怎样才能得出这个观点? ……你问了两个问题 1如何在android中绘制此xml布局 您应该尝试一些xml代码,并在遇到困难的地方发布 2如何将X按钮定位在布局的中间底部 为此,请使用父布局作为“相对布局”,并将您的视图放置在一个位置,假设您的ImageView为layout\u alignParentBottom=true和layout\u centerHorizontal=true。您也可以参考下面的代码 <RelativeLayout xmlns:android="htt

我怎样才能得出这个观点?
……你问了两个问题 1如何在android中绘制此xml布局

您应该尝试一些xml代码,并在遇到困难的地方发布

2如何将X按钮定位在布局的中间底部

为此,请使用父布局作为“相对布局”,并将您的视图放置在一个位置,假设您的ImageView为layout\u alignParentBottom=true和layout\u centerHorizontal=true。您也可以参考下面的代码

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

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Testing"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"/>

</RelativeLayout>

使用相对布局进行定位

使用没有背景色的X图像按钮并将其放置在中心 使用


使用相对布局使用约束布局
<ImageButton android:id="@+id/btnid" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:background="@drawable/(X)image">
</ImageButton>