ディレクトリ 検索
android Manifest Manifest.permission Manifest.permission_group android.accessibilityservice AccessibilityService android.accounts Account android.app NotificationManager android.bluetooth BluetoothAdapter BluetoothClass BluetoothClass.Device BluetoothClass.Device.Major BluetoothClass.Service BluetoothDevice BluetoothServerSocket BluetoothSocket android.content SharedPreferences android.database.sqlite SQLiteCursorDriver SQLiteOpenHelper android.graphics Bitmap android.location LocationListener Geocoder GpsStatus GpsStatus.Listener GpsStatus.NmeaListener GpsSatellite android.media AudioFormat AsyncPlayer AudioRecord AudioRecord.OnRecordPositionUpdateListener ThumbnailUtils AudioManager android.net TrafficStats MailTo LocalSocket android.os AsyncTask AsyncTask.Status CountDownTimer Message MessageQueue HandlerThread android.text Html android.util JsonWriter android.view ContextMenu ContextMenu.ContextMenuInfo Display ViewManager View ViewStub ViewTreeObserver ViewParent WindowManager GestureDetector Gravity MenuInflater ScaleGestureDetector SoundEffectConstants android.view.inputmethod InputConnection InputMethod InputMethodSession BaseInputConnection InputMethodManager android.widget AbsListView AbsListView.LayoutParams AbsListView.OnScrollListener AbsListView.RecyclerListener AbsoluteLayout AbsoluteLayout.LayoutParams AbsSeekBar AbsSpinner AdapterView AdapterView.AdapterContextMenuInfo AdapterView.OnItemLongClickListener AdapterView.OnItemSelectedListener AdapterView.OnItemClickListener AnalogClock BaseAdapter BaseExpandableListAdapter Button CheckBox CheckedTextView Checkable Chronometer Chronometer.OnChronometerTickListener CompoundButton CompoundButton.OnCheckedChangeListener CursorAdapter CursorTreeAdapter DatePicker DatePicker.OnDateChangedListener DialerFilter DigitalClock EditText Filter Filter.FilterListener Filter.FilterResults ExpandableListAdapter ExpandableListView.OnChildClickListener ExpandableListView.OnGroupClickListener ExpandableListView.OnGroupCollapseListener ExpandableListView.OnGroupExpandListener Filterable Gallery Gallery.LayoutParams GridView GridLayout GridLayout.Alignment RadioGroup ImageView ImageView.ScaleType HorizontalScrollView ImageButton ImageSwitcher FilterQueryProvider ListAdapter ListView MediaController MultiAutoCompleteTextView MultiAutoCompleteTextView.CommaTokenizer MultiAutoCompleteTextView.Tokenizer QuickContactBadge RadioButton RatingBar RatingBar.OnRatingBarChangeListener RelativeLayout RemoteViews ResourceCursorAdapter ResourceCursorTreeAdapter Scroller ScrollView SearchView SearchView.OnCloseListener SearchView.OnQueryTextListener SearchView.OnSuggestionListener SeekBar SeekBar.OnSeekBarChangeListener SimpleAdapter SimpleAdapter.ViewBinder SimpleCursorAdapter SimpleCursorAdapter.CursorToStringConverter SimpleCursorAdapter.ViewBinder SimpleCursorTreeAdapter SimpleCursorTreeAdapter.ViewBinder SimpleExpandableListAdapter SlidingDrawer SlidingDrawer.OnDrawerCloseListener SlidingDrawer.OnDrawerOpenListener SlidingDrawer.OnDrawerScrollListener Spinner SpinnerAdapter WrapperListAdapter TabHost TabHost.TabSpec TextView TimePicker TimePicker.OnTimeChangedListener Toast TableLayout TableLayout.LayoutParams TableRow TableRow.LayoutParams TabWidget TextSwitcher ToggleButton TwoLineListItem VideoView ViewAnimator ViewFlipper ViewSwitcher ViewSwitcher.ViewFactory ZoomButtonsController ZoomButtonsController.OnZoomListener ZoomButton ZoomControls dalvik.system DexFile
テキスト


TableRow

版本:Android 3.0 r1

 

类结构

public class TableRow extends LinerLayout

 

java.lang.Object

android.view.View

       android.view.ViewGroup

              android.widget.LinearLayout

                     android.widget.TableRow

 

类概述

按照水平方向来组织子视图的布局。TableRow应该总是作为TableLayout的子视图。如果TableRow的父视图不是TableLayout,那么TableRow将相当于一个水平方向布局的LinearLayout

XML配置文件中TableRow的子视图不需要详细指定其layout_widthlayout_height属性值。TableRow总是强制将这两个属性分别赋值为MATCH_PARENTWRAP_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)

返回指定索引的视图。这个方法被重载时应当考虑到其虚拟子视图。参见TableLayoutTableRow的示例代码。

参数

子视图的索引

返回值

                       指定索引的子视图

 

public int getVirtualChildCount ()

返回虚拟子视图的个数。如果这个布局支持子视图,此数量可能与实际子视图数量不同。     参见TableLayoutTableRow的示例代码。

返回值

                       虚拟子视图的数量

 

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的布局参数,可能从指定的一组布局参数集合中复制适当的属性。

参数

被转换成一组适合当前ViewGroup的布局参数

返回值

                       一个ViewGroup.LayoutParams的实例或者其中的一个子节点

 

protected void onLayout (boolean changed, int l, int t, int r, int b)

在此视图设置其子视图的大小及位置时调用。派生类可以重写此方法并重新为其子类布         局。

参数

changed  这是当前视图的一个新大小或位置

相对于父节点的左边位置

相对于父节点的顶点位置

相对于父节点的右边位置

相对于父节点的底部位置

 

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进行编码

 

补充

推荐教程:

Android Doc官方教程-TableLayout中使用TableRow

TableLayout中使用TableRow对象来定义多行

 

 


前の記事: 次の記事: