带有关闭按钮的自定义对话框 [英] custom dialog with close button
本文介绍了带有关闭按钮的自定义对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用如图所示的布局创建一个自定义对话框.交叉/关闭按钮必须位于右上角.请建议我如何实现这种布局.
I want to create a custom dialog with the layout as shown in the picture. The cross/close button must be on the top right side. Please suggest how can i achieve this kind of layout.
提前致谢.
推荐答案
可能下面的代码对你有用,这样实现
might be below code is useful for you,achieved like this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:orientation="vertical" >
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:background="@drawable/popup_password_latest"
android:gravity="center"
android:orientation="vertical"
android:paddingBottom="-50dp" >
<!---add your views here-->
</LinearLayout>
<ImageView
android:id="@+id/imageView_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:clickable="true"
android:src="@drawable/close_selector" />
</FrameLayout>
</LinearLayout>
这篇关于带有关闭按钮的自定义对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文