Android自定义泡泡效果
从网上看到一个帖子不错就转来看看!
http://www.eoeandroid.com/thread-24780-1-1.html
内容也比较丰富。
还有代码在附件中。
popupwindow
A popup window that can be used to display an arbitrary view. The popup windows is a floating container that appears on top of the current activity.
一个弹出窗口,可以用来显示一个任意的看法。弹出窗口是一个浮动的容器,对当前活动顶部
PopupWindow.OnDismissListener Listener that is called when this popup window is dismissed.
PopupWindow.OnDismissListener监听器被调用时,这个弹出窗口被驳回。
setOnDismissListener(PopupWindow.OnDismissListener onDismissListener)在取消弹出窗口时出发的事件。
其 PopupWindow.setInputMethodMode(INPUT_METHOD_FROM_FOCUSABLE|INPUT_METHOD_NEEDED|INPUT_METHOD_NOT_NEEDED )来设置解释如下:
INPUT_METHOD_FROM_FOCUSABLE为对输入法的要求,应根据该弹出可聚焦能力。
诠释INPUT_METHOD_NEEDED为这个弹出总是需要使用一个输入法,不管它是否是可聚焦。
诠释INPUT_METHOD_NOT_NEEDED为这个弹出从未需要与一个输入法,不管它是否是可聚焦。
PopupWindow构造方法如下:
PopupWindow(Context context)
PopupWindow(Context context, AttributeSet attrs)
PopupWindow(Context context, AttributeSet attrs, int defStyle)
PopupWindow()
PopupWindow(View contentView)
PopupWindow(int width, int height)
PopupWindow(View contentView, int width, int height)
PopupWindow(View contentView, int width, int height, boolean focusable)
常用的方法:
dismiss() 关闭弹出的窗口
getContentView
getBackground
isClippingEnabled是否裁剪启用
isFocusable是否弹出窗口可以抓住焦点
boolean isShowing() 是否表明弹出窗口显示在屏幕上
boolean isTouchable() 是否弹出窗口支持触摸事件
setClippingEnabled(boolean enabled)
setContentView( contentView) 更改弹出的内容
setFocusable(boolean focusable)
setHeight(int height) 更改弹出的高度
setOutsideTouchable(boolean touchable) 控制是否弹出窗口将被告知触摸事件的窗口外面。
void setWidth(int width)
void setTouchable(boolean touchable)
void setTouchInterceptor(View.OnTouchListener l)所有设置触摸事件回调被派往该弹出窗口
setWindowLayoutMode(int widthSpec, int heightSpec) 更改宽度和高度的措施,都是通过弹出的窗口管理规范
showAsDropDown(View anchor, int xoff, int yoff)
Display the content view in a popup window anchored to the bottom-left corner of the anchor view offset by the specified x and y coordinates.
showAsDropDown(View anchor)
Display the content view in a popup window anchored to the bottom-left corner of the anchor view.
showAtLocation(View parent, int gravity, int x, int y)显示在弹出式窗口的内容以便在指定的位置
更新
update(int width, int height)
update(View anchor, int xoff, int yoff, int width, int height)
update()
update(int x, int y, int width, int height, boolean force)
update(int x, int y, int width, int height)
update(View anchor, int width, int height)
Android自定义泡沫效果
Android自定义泡泡效果从网上看到一个帖子不错就转来看看!http://www.eoeandroid.com/thread-24780-1-1.ht
