如何在android中显示自定义矩形警报对话框

时间:2018-01-30 03:21:08

标签: android kotlin

<RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/dialog_bg"
            android:orientation="vertical">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="20dp"
                android:layout_marginTop="20dp">

                <TextView
                    android:id="@+id/nameText"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_toRightOf="@id/profilePic"
                    android:ems="10"
                    android:fontFamily="sans-serif-medium"
                    android:letterSpacing="-0.03"
                    android:paddingRight="@dimen/margin_20dp"
                    android:text="Ajay Kulkarni"
                    android:textColor="#3e4360"
                    android:textSize="16sp"
                    android:textStyle="normal" />
                        <TextView
                    android:id="@+id/designation"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/nameText"
                    android:fontFamily="sans-serif"
                    android:gravity="end"
                    android:layout_toRightOf="@id/profilePic"

                    android:letterSpacing="-0.03"
                    android:paddingRight="@dimen/margin_20dp"
                    android:text=""
                    android:textSize="12sp"
                    android:textStyle="normal" />

                <com.kdcos.contsync.utilities.RoundedImageView
                    android:id="@+id/profilePic"
                    android:layout_width="32dp"
                    android:layout_height="32dp"
                    android:layout_alignParentStart="true"
                    android:background="@drawable/ic_my_profile" />

            </RelativeLayout>


        </RelativeLayout>
警报对话框的

功能:

 fun showChangeLangDialog(item: ReceivedCardModel) {
        val dialogBuilder = AlertDialog.Builder(this)
        val dialogBinding: DialogAttendeesDetailBinding = DataBindingUtil.inflate(LayoutInflater.from(this), R.layout.dialog_attendees_detail, null, false)
        dialogBuilder.setView(dialogBinding.root)
        val b = dialogBuilder.create()}

我当前的屏幕就像方形对话框,而我的预期屏幕就像是在景观模式中的矩形我试图从顶部和右边给出填充但是不能得到矩形对话框。请建议我如何做到这一点谢谢。我期望的屏幕是这样的: enter image description here

0 个答案:

没有答案