赫克歇尔 俄林理论:android布局属性详解1

来源:百度文库 编辑:中财网 时间:2024/05/01 18:56:35
android:id
为控件指定相应的ID
android:text
指定控件当中显示的文字,需要注意的是,这里尽量使用strings.xml文件当中的字符串
android:gravity
指定View组件的对齐方式,比如说居中,居右等位置 这里指的是控件中的文本位置并不是控件本身
android:layout_gravity
指定Container组件的对齐方式.比如一个button 在linearlayout里,你想把该button放在靠左、靠右等位置就可以通过该属性设置.以button为 例,android:layout_gravity="right"则button靠右
android:textSize
指定控件当中字体的大小
android:background
指定该控件所使用的背景色,RGB命名法
android:width
指定控件的宽度
android:height
指定控件的高度
android:layout_width
指定Container组件的宽度
android:layout_height
指定Container组件的高度
android:layout_weight
View中很重要的属性,按比例划分空间
android:padding*
指定控件的内边距,也就是说控件当中的内容
android:sigleLine
如果设置为真的话,则控件的内容在同一行中进行显示
android:scaleType
是控制图片如何resized/moved来匹对ImageView的siz
android:layout_centerHrizontal
水平居中
android:layout_centerVertical
垂直居中
android:layout_centerInparent
相对于父元素完全居中
android:layout_alignParentBottom
贴紧父元素的下边缘
android:layout_alignParentLeft
贴紧父元素的左边缘
android:layout_alignParentRight
贴紧父元素的右边缘
android:layout_alignParentTop
贴紧父元素的上边缘
android:layout_alignWithParentIfMissing
如果对应的兄弟元素找不到的话就以父元素做参照物
android:layout_below
在某元素的下方
android:layout_above
在某元素的的上方
android:layout_toLeftOf
在某元素的左边
android:layout_toRightOf
在某元素的右边
android:layout_alignTop
本元素的上边缘和某元素的的上边缘对齐
android:layout_alignLeft
本元素的左边缘和某元素的的左边缘对齐
android:layout_alignBottom
本元素的下边缘和某元素的的下边缘对齐
android:layout_alignRight
本元素的右边缘和某元素的的右边缘对齐
android:layout_marginBottom
离某元素底边缘的距离
android:layout_marginLeft
离某元素左边缘的距离
android:layout_marginRight
离某元素右边缘的距离
android:layout_marginTop
离某元素上边缘的距离
android:paddingLeft
本元素内容离本元素右边缘的距离
android:paddingRight
本元素内容离本元素上边缘的距离
android:hint
设置EditText为空时输入框内的提示信息
android:LinearLayout
它确定了LinearLayout的方向,其值可以为vertical, 表示垂直布局horizontal, 表示水平布局

-----------------------------------------------------------------------------------------------------------------------------------------------------
android:interpolator
可能有很多人不理解它的用法,文档里说的也不太清楚,其实很简单,看下面:interpolator定义一个动画的变化率(the rate of change)。这使得基本的动画效果(alpha, scale, translate, rotate)得以加速,减速,重复等。用通俗的一点的话理解就是:动画的进度使用 Interpolator 控制。interpolator 定义了动画的变化速度,可以实现匀速、正加速、负加速、无规则变加速等。Interpolator 是基类,封装了所有 Interpolator 的共同方法,它只有一个方法,即 getInterpolation (float input),该方法 maps a point on the timeline to a multiplier to be applied to the transformations of an animation。Android 提供了几个 Interpolator 子类,实现了不同的速度曲线,如下:
AccelerateDecelerateInterpolator        在动画开始与介绍的地方速率改变比较慢,在中间的时侯加速
AccelerateInterpolator        在动画开始的地方速率改变比较慢,然后开始加速
CycleInterpolator        动画循环播放特定的次数,速率改变沿着正弦曲线
DecelerateInterpolator        在动画开始的地方速率改变比较慢,然后开始减速
LinearInterpolator        在动画的以均匀的速率改变
对于 LinearInterpolator ,变化率是个常数,即 f (x) = x.
public float getInterpolation(float input) {
return input;
}
Interpolator其他的几个子类,也都是按照特定的算法,实现了对变化率。还可以定义自己的 Interpolator 子类,实现抛物线、自由落体等物理效果。