自定义对话框样式和老师的不一样
来源:3-1 自定义对话框
幕布斯1273652
2018-04-15 17:04:42
<?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:orientation="vertical" android:gravity="center_horizontal" android:background="@color/powderblue"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="提示" android:textSize="34sp" android:textStyle="bold" android:layout_marginTop="30dp"/> <View android:layout_width="match_parent" android:layout_height="2dp" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:background="@color/whitesmoke"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="您确认要退出当前程序吗?"/> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_horizontal" android:layout_marginTop="10dp"> <Button android:layout_width="wrap_content" android:layout_height="match_parent" android:text="是" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="否"/> </LinearLayout> </LinearLayout> 这是我的xml布局文件,我在实例化类后显示,发现并没有出现老师所说的上边框和白边,而且左右距离为什么没有了,和xml中显示的不一样
1回答
好帮手慕雪
2018-04-16
1)不同手机版本的对话框,都稍有区别。所以不一定跟老师的一模一样的。
2)左右距离你没有设置,所以没有你说的效果呀。
祝:学习愉快
相似问题