首页
IT
登录
6mi
u
盘
搜
搜 索
IT
自定义对话框的宽高
自定义对话框的宽高
xiaoxiao
2021-12-14
18
private void
datatongbuDialog
() {
//数据同步
View dialogView = View.
inflate
(
this,
R.layout.
dialog_tongbu
, null
)
;
final
Dialog dialog =
new
AlertDialog.Builder(
this
).create()
;
dialog.show()
;
dialog.getWindow().setContentView(dialogView)
;
dialog.getWindow().setLayout(400, 220);
dialog.getWindow().setGravity(Gravity.
CENTER
)
;
}
R.layout.
dialog_tongbu 布局:
<?
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=
"match_parent"
android
:background=
"@drawable/shipin_shezhi_shape_round_bg"
android
:orientation=
"vertical"
>
<TextView
android
:id=
"@+id/title"
android
:layout_width=
"match_parent"
android
:layout_height=
"wrap_content"
android
:gravity=
"center"
android
:padding=
"15dp"
android
:textColor=
"#333333"
android
:text=
"同步完成"
android
:textSize=
"20sp"
/>
<View
style=
"@style/separator_line"
android
:layout_marginLeft=
"15dp"
android
:layout_marginRight=
"15dp"
/>
<RelativeLayout
android
:layout_width=
"match_parent"
android
:layout_height=
"200dp"
>
<ImageView
android
:layout_width=
"30dp"
android
:layout_height=
"30dp"
android
:layout_centerInParent=
"true"
android
:background=
"@drawable/xiaolian"
android
:text=
"52Mbps"
/>
</RelativeLayout>
<View
android
:visibility=
"gone"
style=
"@style/separator_line"
android
:layout_marginLeft=
"15dp"
android
:layout_marginRight=
"15dp"
/>
</LinearLayout>
转载请注明原文地址: https://ju.6miu.com/read-964376.html
专利
最新回复
(
0
)