- android
- android.accessibilityservice
- android.accounts
- android.content
- android.database.sqlite
- android.graphics
- android.location
- android.media
- android.net
- android.os
- android.text
- android.view
- android.view.inputmethod
- android.widget
- AbsListView
- AbsoluteLayout
- AbsSeekBar
- AbsSpinner
- AdapterView
- AnalogClock
- BaseAdapter
- BaseExpandableListAdapter
- Button
- CheckBox
- CheckedTextView
- Checkable
- Chronometer
- CompoundButton
- CursorAdapter
- CursorTreeAdapter
- DatePicker
- DialerFilter
- DigitalClock
- EditText
- Filter
- Filter.FilterListener
- Filter.FilterResults
- ExpandableListAdapter
- Filterable
- Gallery
- Gallery.LayoutParams
- GridView
- GridLayout
- RadioGroup
- ImageView
- HorizontalScrollView
- ImageButton
- ImageSwitcher
- FilterQueryProvider
- ListAdapter
- ListView
- MediaController
- QuickContactBadge
- RadioButton
- RatingBar
- RelativeLayout
- RemoteViews
- ResourceCursorAdapter
- ResourceCursorTreeAdapter
- Scroller
- ScrollView
- SearchView
- SeekBar
- SeekBar.OnSeekBarChangeListener
- SimpleAdapter
- SimpleCursorAdapter
- SimpleCursorTreeAdapter
- SimpleExpandableListAdapter
- SlidingDrawer
- Spinner
- SpinnerAdapter
- WrapperListAdapter
- TabHost
- TabHost.TabSpec
- TextView
- TimePicker
- Toast
- TableLayout
- TableRow
- TableRow.LayoutParams
- TabWidget
- TextSwitcher
- ToggleButton
- TwoLineListItem
- VideoView
- ViewAnimator
- ViewFlipper
- ViewSwitcher
- ZoomButtonsController
- ZoomButton
- ZoomControls
- dalvik.system
TableRow
TableRow
版本:Android 3.0 r1
类结构
public class TableRow extends LinerLayout
android.widget.TableRow
类概述
按照水平方向来组织子视图的布局。TableRow 应该总是作为 TableLayout 的子视图。如果 TableRow 的父视图不是 TableLayout,那么 TableRow 将相当于一个水平方向布局的 LinearLayout 。
在 XML 配置文件中 TableRow 的子视图不需要详细指定其 layout_width 和 layout_height 属性值。TableRow 总是强制将这两个属性分别赋值为 MATCH_PARENT 和 WRAP_CONTENT 。
可参考 android.widget.TableRow.LayoutParams 的布局属性。
内部类
class TableRow.LayoutParams
适用于 TableRow 的子视图的属性设置
构造函数
public TableRow ( Context context)
为给定的上下文创建 TableRow 布局。
参数
context 应用程序环境
public TableRow ( Context context, AttributeSet attrs)
使用指定的属性集合为给定的上下文创建 TableRow 布局。
参数
context 应用程序环境
attrs 属性集合
公共方法
public TableRow.LayoutParams generateLayoutParams ( AttributeSet attrs)
返回一组基于提供的属性集合的布局参数集合。
参数
attrs 用于生成布局参数的属性集
返回值
ViewGroup.LayoutParams 或其子类的实例
public View getVirtualChildAt (int i)
返回指定索引的视图。这个方法被重载时应当考虑到其虚拟子视图。参见 TableLayout 和 TableRow 的示例代码。
参数
i 子视图的索引
返回值
指定索引的子视图
public int getVirtualChildCount ()
返回虚拟子视图的个数。如果这个布局支持子视图,此数量可能与实际子视图数量不同。 参见 TableLayout 和 TableRow 的示例代码。
返回值
虚拟子视图的数量
public void setOnHierarchyChangeListener ( ViewGroup.OnHierarchyChangeListener listener)
注册一个回调函数,当从视图中添加或移除子视图时被调用。
参数
listener 层次结构变更时执行的回调函数
受保护方法
protected boolean checkLayoutParams ( ViewGroup.LayoutParams p)
(译者注:检测是不是 AbsoluteLayout.LayoutParams 的实例)
protected LinearLayout.LayoutParams generateDefaultLayoutParams ()
返回宽度为 MATCH_PARENT ,高度为 WRAP_CONTENT 且没有跨度的布局参数集合。
返回值
默认布局参数集合或空
protected LinearLayout.LayoutParams generateLayoutParams ( ViewGroup.LayoutParams p)
返回一组合法的受支持的布局参数集合。当一个 ViewGroup 传递一个布局参数没有通过 checkLayoutParams(android.view.ViewGroup.LayoutParams) 检测的视图时,此方法将被调用。此方法会返回一组新的适合当前 ViewGroup 的布局参数,可能从指定的一组布局参数集合中复制适当的属性。
参数
p 被转换成一组适合当前 ViewGroup 的布局参数
返回值
一个 ViewGroup.LayoutParams 的实例或者其中的一个子节点
protected void onLayout (boolean changed, int l, int t, int r, int b)
在此视图设置其子视图的大小及位置时调用。派生类可以重写此方法并重新为其子类布 局。
参数
changed 这是当前视图的一个新大小或位置
l 相对于父节点的左边位置
t 相对于父节点的顶点位置
r 相对于父节点的右边位置
b 相对于父节点的底部位置
protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec)
测量视图及其内容,以确定其宽度和高度。此方法由 measure(int, int) 调用。需要被子类重写以提供准确、高效的测量其内容的方法。
约定 :当重写此方法时,必须调用 setMeasuredDimension(int, int) 来保存当前视图的宽度和高度。如果调用不成功将会导致一个 IllegalStateException 异常,由 measure(int, int) 抛出。要有效的调用父类的 onMeasure(int, int) 方法。
基类的实现是以背景大小为默认大小,除非 MeasureSpec(测量细则)允许更大的背景。子类应重写 onMeasure(int, int) 以对其内容提供更合适的大小。
如果此方法被重写,那么子类要确保其测量高度和测量宽度要大于视图的最小宽度和最小高度( getSuggestedMinimumHeight() 和 getSuggestedMinimumWidth() )。
参数
widthMeasureSpec 父视图要求的横向空间大小。该要求由 View.MeasureSpec 进行编码
heightMeasureSpec 父视图要求的纵向空间大小。该要求由 View.MeasureSpec 进行编码
补充
推荐教程:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论