Android如何创建弹出窗口

编程入门 行业动态 更新时间:2024-10-28 18:30:01
本文介绍了Android如何创建弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要创建一个带有按钮的弹出窗口和一个关闭弹出窗口的按钮.我找到了一些教程,但我不知道如何实现.

I need to create a popup window with buttons and a button that will close the popup. I found some tutorials but I couldn't find out how to do the implementation.

我想要做什么:单击一个操作按钮并显示弹出窗口,当我单击关闭按钮时,弹出窗口必须关闭.

What I want to do: Click an action button and the popup shows and when I click the the close button the popup window must close.

教程中有一个onCreate方法,我不明白它是怎么调用的.

There were an onCreate method in the tuorials and I didn't understand how is it called.

谁能给出一个弹出实现的例子或一个好的教程的链接?谢谢!

Can somebody give an example of an popup implementation or a link to a good tutorial? Thank you!

推荐答案

private void showPopup(){ Button btn_closepopup=(Button)layout.findViewById(R.id.btn_closePoppup); pwindo=new PopupWindow(layout,480,500,true); pwindo.showAtLocation(layout, Gravity.CENTER, 0, 40); chartContainer1.addView(mChart); btn_closepopup.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub pwindo.dismiss(); } }); }

更多推荐

Android如何创建弹出窗口

本文发布于:2023-08-06 04:34:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1310095.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出窗口   Android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!