PopupWindow(泡泡)
来源:互联网 发布:学习编程语言的网站 编辑:程序博客网 时间:2024/04/19 17:25
public class MainActivity extends Activity implements OnClickListener { private PopupWindow popup; private View view; private View view1; private Button deng1; private Button zhu2; private View view2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); deng1 = (Button) findViewById(R.id.deng_01); deng1.setOnClickListener(this); view = View.inflate(MainActivity.this,R.layout.pop, null); popup = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); popup.setOutsideTouchable(true); popup.setBackgroundDrawable(new BitmapDrawable()); popup.setFocusable(true); // zhu2 = (Button) findViewById(R.id.zhu_01); zhu2.setOnClickListener(this); view1 = View.inflate(MainActivity.this,R.layout.zhuche, null); view2 = View.inflate(MainActivity.this,R.layout.activity_main, null); popup = new PopupWindow(view1, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); popup.setOutsideTouchable(true); popup.setBackgroundDrawable(new BitmapDrawable()); popup.setFocusable(true); Button button = (Button) view1.findViewById(R.id.button); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainActivity.this," 注册 ",Toast.LENGTH_LONG).show(); } }); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.deng_01: popup.showAsDropDown(deng1); break; case R.id.zhu_01: popup.showAtLocation(view2, Gravity.TOP, 0, 100); break; default: break; } }}
activity
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_centerInParent="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" > <Button android:id="@+id/deng_01" android:layout_alignParentRight="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="登陆" /> <Button android:id="@+id/zhu_01" android:layout_alignParentRight="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="快速注册" /> </LinearLayout></RelativeLayout>
pop
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#FFA980" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="请输入用户名" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="请输入密码" /> <Button android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="登陆" /> </LinearLayout></RelativeLayout>
zhuche
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#00CCCC" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" > <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="请输入用户名" /> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="请输入密码" /> <Button android:layout_gravity="center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/button" android:text="注册" /></LinearLayout></RelativeLayout>
阅读全文
0 0
- PopupWindow(泡泡)
- PopupWindow泡泡窗口
- PopupWindow(泡泡窗口)的简单实用
- android学习笔记---63-PopupWindow,泡泡窗口的实现
- Android——PopupWindow(泡泡)初体验
- Bubbles Shader in Houdini泡泡泡泡泡泡泡泡泡泡
- popupwindow
- popupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- popupwindow
- PopupWindow
- PopupWindow
- PopupWindow
- PopupWindow
- maven中自定义变量
- Excel写进Oracle数据库以及从oracle数据库读取数据到Excel
- [Leetcode] 240. Search a 2D Matrix II 解题报告
- linux下的程序调试方法汇总
- Android应用层View绘制流程与源码分析
- PopupWindow(泡泡)
- QT之UDP通信总结
- PCA 的数学原理和可视化效果
- eclipse配置tomcat后修改server.xml文件(如编码等)无效问题
- reactor/proactor两种高效的事件处理模式和并发模式
- A*与K短路
- Android 数据储存的方式之本地数据库储存
- 关于ORA-00257: archiver error. Connect internal only, until freed 错误的处理方法
- xuenhao(imageloder xlistview)