当前位置:网站首页>Create dialog style windows with popupwindow
Create dialog style windows with popupwindow
2022-07-07 17:37:00 【XLMN】
Use popupwindow Create a dialog style window
public class MainActivity extends Activity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.popupwindow);
// load r.layout.popup The corresponding layout file
View root = this.getLayoutInflater().inflate(R.layout.popup, null);
// Create popupwindow object
final PopupWindow pw = new PopupWindow(root, 1560, 1720);
Button bt = findViewById(R.id.button2);
bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// The following pull mode shows
pw.showAsDropDown(v);
// take popupwindow Display in the specified location
pw.showAtLocation(findViewById(R.id.button2), Gravity.CENTER, 20, 20);
}
});
// obtain popupwindow Medium close button
root.findViewById(R.id.close).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// close popupwindow
pw.dismiss();
}
});
}
}
<ImageView
android:layout_width="wrap_content"
android:layout_height="560dp"
android:src="@drawable/mia1" />
<Button
android:id="@+id/close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" close " />
<?xml version="1.0" encoding="utf-8"?> <Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text=" eject popop window " />
边栏推荐
- 第1章CRM核心业务介绍
- User defined view essential knowledge, Android R & D post must ask 30+ advanced interview questions
- [video / audio data processing] Shanghai daoning brings you elecard download, trial and tutorial
- 【网络攻防原理与技术】第3章:网络侦察技术
- First in China! Todesk integrates RTC technology into remote desktop, with clearer image quality and smoother operation
- [Huang ah code] Why do I suggest you choose go instead of PHP?
- 第3章业务功能开发(用户登录)
- Linux 安装mysql8.X超详细图文教程
- DevOps 的运营和商业利益指南
- Functions and usage of viewflipper
猜你喜欢
随机推荐
toast会在程序界面上显示一个简单的提示信息
Functions and usage of viewflipper
The server is completely broken and cannot be repaired. How to use backup to restore it into a virtual machine without damage?
【饭谈】Web3.0到来后,测试人员该何去何从?(十条预言和建议)
Leetcode brush questions day49
Sator launched Web3 game "satorspace" and launched hoobi
【网络攻防原理与技术】第6章:特洛伊木马
On Apache Doris Fe processing query SQL source code analysis
Repair method of firewall system crash and file loss, material cost 0 yuan
本周小贴士#136:无序容器
本周小贴士#141:注意隐式转换到bool
第2章搭建CRM项目开发环境(数据库设计)
Flash build API Service - generate API documents
L1-025 正整数A+B(Lua)
Sator推出Web3游戏“Satorspace” ,并上线Huobi
第1章CRM核心业务介绍
DevOps 的运营和商业利益指南
【网络攻防原理与技术】第5章:拒绝服务攻击
赋能智慧电力建设 | 麒麟信安高可用集群管理系统,保障用户关键业务连续性
99%的人都不知道|私有化部署还永久免费的即时通讯软件!