泡泡窗口(二)
来源:互联网 发布:单农男装网络旗舰店 编辑:程序博客网 时间:2024/04/20 11:59
不和任何控件结合。纯生态 是上一篇博客的扩展 这个方法使用起来更加方便
定义一个MainActivity.java 中的内部类
public class SelectPopuWindow extends PopupWindow { private Context context; private int ReuestCode; public SelectPopuWindow(Context mContext, View parent, final int requestCode) { this.ReuestCode = requestCode; this.context = mContext; View view = View .inflate(mContext, R.layout.item_popupwindows, null); view.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.fade_ins)); LinearLayout ll_popup = (LinearLayout) view .findViewById(R.id.ll_popup); ll_popup.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.push_bottom_in_2)); setWidth(LayoutParams.FILL_PARENT); setHeight(LayoutParams.FILL_PARENT); setBackgroundDrawable(new BitmapDrawable()); setFocusable(true); setOutsideTouchable(true); setContentView(view); showAtLocation(parent, Gravity.BOTTOM, 0, 0); update(); Button bt1 = (Button) view .findViewById(R.id.item_popupwindows_camera); Button bt2 = (Button) view .findViewById(R.id.item_popupwindows_Photo); Button bt3 = (Button) view .findViewById(R.id.item_popupwindows_cancel); bt1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(WriteMoodActivity.this, "1", Toast.LENGTH_LONG).show(); }); bt2.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(WriteMoodActivity.this, "2", Toast.LENGTH_LONG).show(); } dismiss(); } }); bt3.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(WriteMoodActivity.this, "23", Toast.LENGTH_LONG).show(); } }); } }
泡泡窗口的布局是写在activity_main.xml 文件中的
<LinearLayout android:id="@+id/ll_popup" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="#ffffff" android:orientation="vertical" > <TextView android:layout_width="match_parent" android:layout_height="1dp" android:background="#ff495a" /> <LinearLayout android:layout_width="match_parent" android:layout_height="55dp" android:orientation="horizontal" > <Button android:id="@+id/item_popupwindows_camera" android:layout_width="match_parent" android:layout_height="55dp" android:background="@drawable/bt_nobgd" android:textColor="#585858" android:textSize="18sp" android:text="拍照" /> </LinearLayout>
关于动画方面我就不粘大家可以看上一篇博客
0 0
- 泡泡窗口(二)
- PopupWindow(泡泡窗口)的简单实用
- PopupWindow泡泡窗口
- java编程加载窗口,制作动画(屏保泡泡)
- pop泡泡悬浮窗口BJ
- Android中泡泡窗口二级筛选效果
- android学习笔记---63-PopupWindow,泡泡窗口的实现
- 泡泡窗口实现下拉菜单,以及改变布局高度
- 基于cocos2d-x简易泡泡龙游戏二
- js父子窗口(二)
- C# 窗口实现Win7简单屏幕泡泡保护程序 和实现聊天窗口震动
- 吹泡泡之路(2015.4.25)
- 排序算法系列--冒泡泡泡(C++)
- Bubbles Shader in Houdini泡泡泡泡泡泡泡泡泡泡
- 第一个窗口程序(二.分析窗口程序)
- Android学习笔记_35_PopupWindow泡泡窗口的实现及GridView应用
- jQuery Mobile基础09----jQuery Mobile Widgets(2)-popup(泡泡窗口
- 第七讲 窗口工具(二)
- HDU 5071 Chat (神一般的模拟题)
- C++类型转换小疑惑
- zoj 3820 求三遍树的中心
- 联想键盘功能键不好使,看这里
- 约瑟夫问题
- 泡泡窗口(二)
- leetcode 126: Word Ladder II
- 关于GPS坐标系的几种概念以及相互转化(WGS84,GCJ02, BD09)
- 抽象工厂
- To the Max(zoj 1074)最大子距阵和
- 第2周工作周报-2组-王亮晶
- 杭电(oj)ACM 2586 简单LCA
- ios本地存储-偏好设置(NSUserDefaults)
- iptables linux下的防火墙