与关闭按钮自定义对话框 [英] custom dialog with close button

查看:129
本文介绍了与关闭按钮自定义对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建的布局定制对话框如图所示的图片。 交叉/关闭按钮必须在右上方。 请建议我怎样才能实现这种布局。

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.

在此先感谢。

推荐答案

可能会低于code是对您有用,取得这样的

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆