先贴一下显示效果图,仅作参考:
代码如下:
1、自定义Dialog
public
class
SelectDialog extends AlertDialog{
public SelectDialog(Context context, int theme) {
super(context, theme);
}
public SelectDialog(Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.slt_cnt_type);
}
}
public SelectDialog(Context context, int theme) {
super(context, theme);
}
public SelectDialog(Context context) {
super(context);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.slt_cnt_type);
}
}
2、布局文件slt_cnt_type.xml代码
<?
xml version
=
"
1.0
"
encoding
=
"
utf-8
"
?>
< LinearLayout
xmlns:android = " http://schemas.android.com/apk/res/android "
android:orientation = " vertical "
android:padding = " 10dp " android:layout_width = " 115dp " android:layout_height = " wrap_content " android:background = " @color/blue " >
< Button android:layout_height = " wrap_content " android:background = " #00000000
< LinearLayout
xmlns:android = " http://schemas.android.com/apk/res/android "
android:orientation = " vertical "
android:padding = " 10dp " android:layout_width = " 115dp " android:layout_height = " wrap_content " android:background = " @color/blue " >
< Button android:layout_height = " wrap_content " android:background = " #00000000