700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > android自定义弹框效果合集 android 自定义弹出框AlertDialog 很炫的哦

android自定义弹框效果合集 android 自定义弹出框AlertDialog 很炫的哦

时间:2023-04-05 16:26:48

相关推荐

android自定义弹框效果合集 android 自定义弹出框AlertDialog  很炫的哦

于是就小小的模仿了下自己写了这个这样的效果,

主要代码如下:

dlg = new AlertDialog.Builder(context).create();

dlg.show();

dlg.getWindow().setContentView(R.layout.alert_style);

LayoutInflater factory = LayoutInflater.from(context);

View view = factory.inflate(R.layout.alert_style, null);

gv = (GridView) view.findViewById(R.id.myGrid);

gv.setAdapter(new ImageAdapter(context, new Integer[] {R.drawable.menu_mark_editor,R.drawable.menu_delete}));

dlg.getWindow().setContentView(gv);

其 实原理很简单,就是在弹出框AlertDialog上给他加一个自己的View 我这里使用的是GridView显示的一排图片,效果和UC的差不多!!你也可以使用ListView代替GridView,原理都是一样!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。