完整内容,请查看:http://www.zhdoc.net/android/reference/android/widget/FrameLayout.html
FrameLayout
public class FrameLayout
extends ViewGroup
java.lang.Object | |||
↳ | android.view.View | ||
↳ | android.view.ViewGroup | ||
↳ | android.widget.FrameLayout |
FrameLayout is designed to block out an area on the screen to display a single item. Generally, FrameLayout should be used to hold a single child view, because it can be difficult to organize child views in a way that's scalable to different screen sizes without the children overlapping each other. You can, however, add multiple children to a FrameLayout and control their position within the FrameLayout by assigning gravity to each child, using the android:layout_gravity
attribute.
FrameLayout被设计用来屏蔽屏幕上的一个区域,以显示一个单独的项。一般来说,FrameLayout应该被用来容纳一个单独的子视图,因为它很难组织多个子视图,这种方式可以扩展到不同的屏幕大小,而不需要子项相互重叠。但是,你可以通过使用android:layout_gravity
属性,将多个子项添加到FrameLayout中,并在FrameLayout内控制它们的位置。
Child views are drawn in a stack, with the most recently added child on top. The size of the FrameLayout is the size of its largest child (plus padding), visible or not (if the FrameLayout's parent permits). Views that are GONE
are used for sizing only if setConsiderGoneChildrenWhenMeasuring()
is set to true.
子视图是在栈中绘制的,其中最近添加的子项放置在顶部。FrameLayout大小是它最大的子项(加上内边距(padding))的大小,包括可见的或不可见的子项(如果FrameLayout的父项允许的话)。只有当setConsiderGoneChildrenWhenMeasuring()
被设置为true时,才会使用GONE
的视图。
摘要
嵌套类 | |
---|---|
class | FrameLayout.LayoutParams Per-child layout information for layouts that support margins. |
XML属性 | |
---|---|
android:foregroundGravity | 设置重力,用于前景drawable。 |
android:measureAllChildren | 决定是否测量所有的子项,或者仅仅测量那些在VISIBLE或INVISIBLE状态下的子项。 |
继承XML属性 | |
---|---|
From class android.view.ViewGroup
| |
From class android.view.View
|
继承常量 |
---|
From class android.view.ViewGroup
|
From class android.view.View
|
继承字段 |
---|
From class android.view.View
|
Public构造方法 | |
---|---|
FrameLayout(Context context) | |
FrameLayout(Context context, AttributeSet attrs) | |
FrameLayout(Context context, AttributeSet attrs, int defStyleAttr) | |
FrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) |
Public方法 | |
---|---|
FrameLayout.LayoutParams | generateLayoutParams(AttributeSet attrs) Returns a new set of layout parameters based on the supplied attributes set. |
CharSequence | getAccessibilityClassName() Return the class name of this object to be used for accessibility purposes. |
boolean | getConsiderGoneChildrenWhenMeasuring() This method was deprecated in API level 14. This method is deprecated in favor of |
boolean | getMeasureAllChildren() Determines whether all children, or just those in the VISIBLE or INVISIBLE state, are considered when measuring. |
void | setForegroundGravity(int foregroundGravity) Describes how the foreground is positioned. |
void | setMeasureAllChildren(boolean measureAll) Sets whether to consider all children, or just those in the VISIBLE or INVISIBLE state, when measuring. |
boolean | shouldDelayChildPressedState() Return true if the pressed state should be delayed for children or descendants of this ViewGroup. |