|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.widget.PopupWindow
public class 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.
AutoCompleteTextView,
Spinner| Nested Class Summary | |
|---|---|
(package private) static interface |
PopupWindow.OnDismissListener
Listener that is called when this popup window is dismissed. |
| Constructor Summary | |
|---|---|
PopupWindow()
Create a new empty, non focusable popup window of dimension (0,0). |
|
PopupWindow(Context context)
Create a new empty, non focusable popup window of dimension (0,0). |
|
PopupWindow(Context context,
AttributeSet attrs)
Create a new empty, non focusable popup window of dimension (0,0). |
|
PopupWindow(Context context,
AttributeSet attrs,
int defStyle)
Create a new empty, non focusable popup window of dimension (0,0). |
|
PopupWindow(int width,
int height)
Create a new empty, non focusable popup window. |
|
PopupWindow(View contentView)
Create a new non focusable popup window which can display the contentView. |
|
PopupWindow(View contentView,
int width,
int height)
Create a new non focusable popup window which can display the contentView. |
|
PopupWindow(View contentView,
int width,
int height,
boolean focusable)
Create a new popup window which can display the contentView. |
|
| Method Summary | |
|---|---|
void |
dismiss()
Dispose of the popup window. |
int |
getAnimationStyle()
Return the animation style to use the popup appears and disappears |
Drawable |
getBackground()
Return the drawable used as the popup window's background. |
View |
getContentView()
Return the view used as the content of the popup window. |
int |
getHeight()
Return this popup's height MeasureSpec |
int |
getMaxAvailableHeight(View anchor)
Returns the maximum height that is available for the popup to be completely shown. |
int |
getWidth()
Return this popup's width MeasureSpec |
boolean |
isFocusable()
Indicate whether the popup window can grab the focus. |
boolean |
isShowing()
Indicate whether this popup window is showing on screen. |
void |
setAnimationStyle(int animationStyle)
Change the animation style for this popup. |
void |
setBackgroundDrawable(Drawable background)
Change the background drawable for this popup window. |
void |
setContentView(View contentView)
Change the popup's content. |
void |
setFocusable(boolean focusable)
Changes the focusability of the popup window. |
void |
setHeight(int height)
Change the popup's height MeasureSpec |
void |
setIgnoreCheekPress()
set the flag on popup to ignore cheek press events This method has to be invoked before displaying the content view of the popup for the window flags to take effect and will be ignored if the pop up is already displayed. |
void |
setOnDismissListener(PopupWindow.OnDismissListener onDismissListener)
Sets the listener to be called when the window is dismissed. |
void |
setWidth(int width)
Change the popup's width MeasureSpec |
void |
showAsDropDown(View anchor)
Display the content view in a popup window anchored to the bottom-left corner of the anchor view. |
void |
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. |
void |
showAtLocation(View parent,
int gravity,
int x,
int y)
Display the content view in a popup window at the specified location. |
void |
update(int x,
int y,
int width,
int height)
Updates the position and the dimension of the popup window. |
void |
update(View anchor,
int width,
int height)
Updates the position and the dimension of the popup window. |
void |
update(View anchor,
int xoff,
int yoff,
int width,
int height)
Updates the position and the dimension of the popup window. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PopupWindow(Context context)
Create a new empty, non focusable popup window of dimension (0,0).
The popup does provide a background.
public PopupWindow(Context context,
AttributeSet attrs)
Create a new empty, non focusable popup window of dimension (0,0).
The popup does provide a background.
public PopupWindow(Context context,
AttributeSet attrs,
int defStyle)
Create a new empty, non focusable popup window of dimension (0,0).
The popup does provide a background.
public PopupWindow()
Create a new empty, non focusable popup window of dimension (0,0).
The popup does not provide any background. This should be handled by the content view.
public PopupWindow(View contentView)
Create a new non focusable popup window which can display the contentView. The dimension of the window are (0,0).
The popup does not provide any background. This should be handled by the content view.
contentView - the popup's content
public PopupWindow(int width,
int height)
Create a new empty, non focusable popup window. The dimension of the window must be passed to this constructor.
The popup does not provide any background. This should be handled by the content view.
width - the popup's widthheight - the popup's height
public PopupWindow(View contentView,
int width,
int height)
Create a new non focusable popup window which can display the contentView. The dimension of the window must be passed to this constructor.
The popup does not provide any background. This should be handled by the content view.
contentView - the popup's contentwidth - the popup's widthheight - the popup's height
public PopupWindow(View contentView,
int width,
int height,
boolean focusable)
Create a new popup window which can display the contentView. The dimension of the window must be passed to this constructor.
The popup does not provide any background. This should be handled by the content view.
contentView - the popup's contentwidth - the popup's widthheight - the popup's heightfocusable - true if the popup can be focused, false otherwise| Method Detail |
|---|
public Drawable getBackground()
Return the drawable used as the popup window's background.
public void setBackgroundDrawable(Drawable background)
Change the background drawable for this popup window. The background can be set to null.
background - the popup's backgroundpublic int getAnimationStyle()
Return the animation style to use the popup appears and disappears
public void setIgnoreCheekPress()
public void setAnimationStyle(int animationStyle)
Change the animation style for this popup.
animationStyle - animation style to use when the popup appears and disappearspublic View getContentView()
Return the view used as the content of the popup window.
View representing the popup's contentsetContentView(android.view.View)public void setContentView(View contentView)
Change the popup's content. The content is represented by an instance
of View.
This method has no effect if called when the popup is showing.
contentView - the new content for the popupgetContentView(),
isShowing()public boolean isFocusable()
Indicate whether the popup window can grab the focus.
setFocusable(boolean)public void setFocusable(boolean focusable)
Changes the focusability of the popup window. When focusable, the
window will grab the focus from the current focused widget if the popup
contains a focusable View.
If the popup is showing, calling this method will take effect only the next time the popup is shown.
focusable - true if the popup should grab focus, false otherwiseisFocusable(),
isShowing()public int getHeight()
Return this popup's height MeasureSpec
setHeight(int)public void setHeight(int height)
Change the popup's height MeasureSpec
If the popup is showing, calling this method will take effect only the next time the popup is shown.
height - the height MeasureSpec of the popupgetHeight(),
isShowing()public int getWidth()
Return this popup's width MeasureSpec
setWidth(int)public void setWidth(int width)
Change the popup's width MeasureSpec
If the popup is showing, calling this method will take effect only the next time the popup is shown.
width - the width MeasureSpec of the popupgetWidth(),
isShowing()public boolean isShowing()
Indicate whether this popup window is showing on screen.
public void showAtLocation(View parent,
int gravity,
int x,
int y)
Display the content view in a popup window at the specified location. If the popup window
cannot fit on screen, it will be clipped. See WindowManager.LayoutParams
for more information on how gravity and the x and y parameters are related. Specifying
a gravity of Gravity.NO_GRAVITY is similar to specifying
Gravity.LEFT | Gravity.TOP.
parent - a parent view to get the View.getWindowToken() token fromgravity - the gravity which controls the placement of the popup windowx - the popup's x location offsety - the popup's y location offsetpublic void showAsDropDown(View anchor)
Display the content view in a popup window anchored to the bottom-left corner of the anchor view. If there is not enough room on screen to show the popup in its entirety, this method tries to find a parent scroll view to scroll. If no parent scroll view can be scrolled, the bottom-left corner of the popup is pinned at the top left corner of the anchor view.
anchor - the view on which to pin the popup windowdismiss()
public void 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. If there is not enough room on screen to show the popup in its entirety, this method tries to find a parent scroll view to scroll. If no parent scroll view can be scrolled, the bottom-left corner of the popup is pinned at the top left corner of the anchor view.
anchor - the view on which to pin the popup windowdismiss()public int getMaxAvailableHeight(View anchor)
anchor - The view on which the popup window must be anchored.
public void dismiss()
Dispose of the popup window. This method can be invoked only after
showAsDropDown(android.view.View) has been executed. Failing that, calling
this method will have no effect.
showAsDropDown(android.view.View)public void setOnDismissListener(PopupWindow.OnDismissListener onDismissListener)
onDismissListener - The listener.
public void update(int x,
int y,
int width,
int height)
Updates the position and the dimension of the popup window. Width and height can be set to -1 to update location only.
x - the new x locationy - the new y locationwidth - the new width, can be -1 to ignoreheight - the new height, can be -1 to ignore
public void update(View anchor,
int width,
int height)
Updates the position and the dimension of the popup window. Width and height can be set to -1 to update location only.
anchor - the popup's anchor viewwidth - the new width, can be -1 to ignoreheight - the new height, can be -1 to ignore
public void update(View anchor,
int xoff,
int yoff,
int width,
int height)
Updates the position and the dimension of the popup window. Width and height can be set to -1 to update location only.
anchor - the popup's anchor viewxoff - x offset from the view's left edgeyoff - y offset from the view's bottom edgewidth - the new width, can be -1 to ignoreheight - the new height, can be -1 to ignore
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||