充电器上面写的60a50一38充电器输出是什么意思思

法巴认股证焦点
内地股市反覆靠稳
留意 A50牛60470
A50沽14965
日 11:16来源:
内地股市昨日反覆波动,今早走势继续反覆靠稳,市场继续传出内地或会在五一假期前推出利好政策,但同时欧洲局势仍未完全明朗,加上中证监推出创业板除牌机制,触发创业板及业绩较差的股份走势,左右内地股市走势。
上证今早继续处於2,380点水平徘徊,指数暂时仍守稳在10天及50天线之上。追踪内地股市的安硕0中国(2823),今早走势亦反覆偏软,股价失守11元水平,并跌穿10天及100天线。
A50牛证昨日录得逾150万资金流入,为最多资金流入的股份牛熊证,今早相关牛证成交仍然活跃,要继续看好A50,可留意A50牛60470,收回价10.5元,行使价10.2元,12年12月到期,实际杠杆约12.9倍,A50每跳动一格,此牛证便会跳动两格。
若想作较保守的看好部署,可留意A50牛60070,收回价10.2元,行使价9.9元,12年12月到期,实际杠杆约9.6倍,A50每跳动一格,此牛证便会跳动两格。
相反,要看淡A50,可考虑A50熊60468,收回价12.3元,行使价12.6元,12年12月到期,实际杠杆约6.1倍,同样A50每跳动一格,熊证便会跳动两格。
窝轮方面,看好A50可选择A50购18,行使价13.02元,13年11月到期,实际杠杆约4.8倍,引伸波幅29.5%,A50每跳动2格,此轮跳动1.5格;看淡则可考虑A50沽14965,行使价10.68元,12年8月到期,实际杠杆约9.6倍,引伸波幅26.1%,同样A50每跳动2格,此轮跳动1.5格
免责声明:
本资料由香港分行刊发,其并不构成任何建议、邀请、要约或游说买卖结构性产品。结构性产品价格可急升或急跌,投资者或会蒙受全盘损失。有关资产过往表现并不反映将来表现。牛熊证备有强制赎回机制而可能被提早终止,届时 (i) N类牛熊证投资者将不获发任何金额;而(ii) R类牛熊证之剩余价值可能为零。投资者应仔细查阅结构性产品之相关风险及自行评估风险,并在有需要时谘询专业意见。投资者应阅读基本上市文件(包括基本上市文件附件)及补充上市文件内有关结构性产品的所有详情。法国巴黎证券(亚洲)有限公司为结构性产品之流通量提供者,亦可能是其唯一市场参与者。法国巴黎证券(亚洲)有限公司、法国巴黎银行香港分行及其联属公司均不对结构性产品: (i) 能否於预定上市日上市; 及(ii)其上市後之流通量,作出任何声明或保证。
免责声明:本文仅代表作者个人观点,与凤凰网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
[责任编辑:robot]
标签:&&&&
用手机随时随地看新闻
社会娱乐生活探索
04/21 07:02
04/21 07:02
04/21 07:02
04/21 06:49
04/21 11:28
03/09 16:46
02/24 09:56
03/09 16:45
03/09 16:45
02/27 16:10
03/13 08:17
03/12 08:43
03/12 07:22
03/12 07:57
03/20 09:48
09/07 09:38
09/07 09:38
09/07 09:39
09/07 09:39
09/07 09:39
单日流入资金最多个股
明星分析师荐股
59802.05万元
53705.00万元
50584.07万元
46587.51万元
41734.18万元
37124.56万元
36888.77万元
28588.23万元
48小时点击排行
财经 · 房产
娱乐 · 时尚
汽车 · 旅游
科技 · 健康14996人阅读
Android自定义控件基础(4)
转载请标明出处:
  通过前面几篇博客,我们能够自定义出一些比较简单的自定义控件,但是这在实际应用中是远远不够的,为了实现一些比较牛X的效果,比如侧滑菜单、滑动卡片等等,我们还需要了解自定义ViewGroup。官方文档中对ViewGroup这样描述的:
ViewGroup是一种可以包含其他视图的特殊视图,他是各种布局和所有容器的基类,这些类也定义了ViewGroup.LayoutParams类作为类的布局参数。
  之前,我们只是学习过自定义View,其实自定义ViewGroup和自定义View的步骤差不了多少,他们的的区别主要来自各自的作用不同,ViewGroup是容器,用来包含其他控件,而View是真正意义上看得见摸得着的,它需要将自己画出来。ViewGroup需要重写onMeasure方法测量子控件的宽高和自己的宽高,然后实现onLayout方法摆放子控件。而 View则是需要重写onMeasure根据测量模式和父控件给出的建议的宽高值计算自己的宽高,然后再父控件为其指定的区域绘制自己的图形。
根据以往经验我们初步将自定义ViewGroup的步骤定为下面几步:
1. 继承ViewGroup,覆盖构造方法
2. 重写onMeasure方法测量子控件和自身宽高
3. 实现onLayout方法摆放子控件
1. 简单实现水平排列效果
我们先自定义一个ViewGroup作为布局容器,实现一个从左往右水平排列(排满换行)的效果:
* 自定义布局管理器的示例。
public class CustomLayout extends ViewGroup {
private static final String TAG = "CustomLayout";
public CustomLayout(Context context) {
super(context);
public CustomLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
public CustomLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
* 要求所有的孩子测量自己的大小,然后根据这些孩子的大小完成自己的尺寸测量
@SuppressLint("NewApi") @Override
protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec) {
measureChildren(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension( getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec),
getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec));
* 为所有的子控件摆放位置.
protected void onLayout( boolean changed, int left, int top, int right, int bottom) {
final int count = getChildCount();
int childMeasureWidth = 0;
int childMeasureHeight = 0;
int layoutWidth = 0;
int layoutHeight = 0;
int maxChildHeight = 0;
for(int i = 0; i& i++){
View child = getChildAt(i);
childMeasureWidth = child.getMeasuredWidth();
childMeasureHeight = child.getMeasuredHeight();
if(layoutWidth&getWidth()){
left = layoutW
right = left+childMeasureW
top = layoutH
bottom = top+childMeasureH
layoutWidth = 0;
layoutHeight += maxChildH
maxChildHeight = 0;
left = layoutW
right = left+childMeasureW
top = layoutH
bottom = top+childMeasureH
layoutWidth += childMeasureW
if(childMeasureHeight&maxChildHeight){
maxChildHeight = childMeasureH
child.layout(left, top, right, bottom);
布局文件:
&?xml version="1.0" encoding= "utf-8"?&
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width= "wrap_content"
android:layout_height= "wrap_content" &
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:background= "#FF8247"
android:textColor= "#ffffff"
android:textSize="20dip"
android:padding= "20dip"
android:text="按钮1" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:background= "#8B0A50"
android:textColor= "#ffffff"
android:textSize="20dip"
android:padding= "10dip"
android:text="按钮2" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:background= "#7CFC00"
android:textColor= "#ffffff"
android:textSize="20dip"
android:padding= "15dip"
android:text="按钮333333" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:background= "#1E90FF"
android:textColor= "#ffffff"
android:textSize="10dip"
android:padding= "10dip"
android:text="按钮4" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:background= "#191970"
android:textColor= "#ffffff"
android:textSize="20dip"
android:padding= "15dip"
android:text="按钮5" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:background= "#7A67EE"
android:textColor= "#ffffff"
android:textSize="20dip"
android:padding= "20dip"
android:text="按钮6" /&
运行效果:
  运行成功,是不是略有成就感?这个布局就是简单版的LinearLayout设置android:orientation ="horizontal"的效果,比他还牛X一点,还能自动换行(哈哈)。接下来我们要实现一个功能,只需要在布局文件中指定布局属性,就能控制子控件在什么位置(类似相对布局RelativeLayout)。
2. 自定义LayoutParams
  回想一下我们平时使用RelativeLayout的时候,在布局文件中使用android:layout_alignParentRight="true"、android:layout_centerInParent="true"等各种属性,就能控制子控件显示在父控件的上下左右、居中等效果。 在上一篇中,我们有了解过ViewGroup.LayoutParams类,ViewGroup中有两个内部类ViewGroup.LayoutParams和ViewGroup.MarginLayoutParams,MarginLayoutParams继承自LayoutParams,这两个内部类就是ViewGroup的布局参数类,比如我们在LinearLayout等布局中使用的layout_width\layout_hight等以“layout_ ”开头的属性都是布局属性。
  在View中有一个mLayoutParams的变量用来保存这个View的所有布局属性。ViewGroup.LayoutParams有两个属性layout_width和layout_height,因为所有的容器都需要设置子控件的宽高,所以这个LayoutParams是所有布局参数的基类,如果需要扩展其他属性,都应该继承自它。比如RelativeLayout中就提供了它自己的布局参数类RelativeLayout.LayoutParams,并扩展了很多布局参数,我们平时在RelativeLayout中使用的布局属性都来自它 :
name= "RelativeLayout_Layout"&
name ="layout_toLeftOf" format= "reference" /&
name ="layout_toRightOf" format= "reference" /&
name ="layout_above" format="reference" /&
name ="layout_below" format="reference" /&
name ="layout_alignBaseline" format= "reference" /&
name ="layout_alignLeft" format= "reference" /&
name ="layout_alignTop" format= "reference" /&
name ="layout_alignRight" format= "reference" /&
name ="layout_alignBottom" format= "reference" /&
name ="layout_alignParentLeft" format= "boolean" /&
name ="layout_alignParentTop" format= "boolean" /&
name ="layout_alignParentRight" format= "boolean" /&
name ="layout_alignParentBottom" format= "boolean" /&
name ="layout_centerInParent" format= "boolean" /&
name ="layout_centerVertical" format= "boolean" /&
name ="layout_alignWithParentIfMissing" format= "boolean" /&
name ="layout_toStartOf" format= "reference" /&
name ="layout_toEndOf" format="reference" /&
name ="layout_alignStart" format= "reference" /&
name ="layout_alignEnd" format= "reference" /&
name ="layout_alignParentStart" format= "boolean" /&
name ="layout_alignParentEnd" format= "boolean" /&
看了上面的介绍,我们大概知道怎么为我们的布局容器定义自己的布局属性了吧,就不绕弯子了,按照下面的步骤做:
①. 大致明确布局容器的需求,初步定义布局属性
  在定义属性之前要弄清楚,我们自定义的布局容器需要满足那些需求,需要哪些属性,比如,我们现在要实现像相对布局一样,为子控件设置一个位置属性layout_position=”“,来控制子控件在布局中显示的位置。暂定位置有五种:左上、左下、右上、右下、居中。有了需求,我们就在attr.xml定义自己的布局属性(和之前讲的自定义属性一样的操作,不太了解的可以翻阅 。
&?xml version="1.0" encoding= "utf-8"?&
name ="CustomLayout"&
name ="layout_position"&
name ="center" value="0" /&
name ="left" value="1" /&
name ="right" value="2" /&
name ="bottom" value="3" /&
name ="rightAndBottom" value="4" /&
left就代表是左上(按常理默认就是左上方开始,就不用写leftTop了,简洁一点),bottom左下,right 右上,rightAndBottom右下,center居中。属性类型是枚举,同时只能设置一个值。
②. 继承LayoutParams,定义布局参数类
  我们可以选择继承ViewGroup.LayoutParams,这样的话我们的布局只是简单的支持layout_width和layout_height;也可以继承MarginLayoutParams,就能使用layout_marginxxx属性了。因为后面我们还要用到margin属性,所以这里方便起见就直接继承MarginLayoutParams了。
  覆盖构造方法,然后在有AttributeSet参数的构造方法中初始化参数值,这个构造方法才是布局文件被映射为对象的时候被调用的。
public static class CustomLayoutParams extends MarginLayoutParams {
public static final int POSITION_MIDDLE = 0;
public static final int POSITION_LEFT = 1;
public static final int POSITION_RIGHT = 2;
public static final int POSITION_BOTTOM = 3;
public static final int POSITION_RIGHTANDBOTTOM = 4;
public int position = POSITION_LEFT;
public CustomLayoutParams(Context c, AttributeSet attrs) {
super(c, attrs);
TypedArray a = c.obtainStyledAttributes(attrs,R.styleable.CustomLayout );
position = a.getInt(R.styleable.CustomLayout_layout_position ,position );
a.recycle();
public CustomLayoutParams( int width, int height) {
super(width, height);
public CustomLayoutParams(ViewGroup.LayoutParams source) {
super(source);
③. 重写generateLayoutParams()
  在ViewGroup中有下面几个关于LayoutParams的方法,generateLayoutParams (AttributeSet attrs)是在布局文件被填充为对象的时候调用的,这个方法是下面几个方法中最重要的,如果不重写它,我么布局文件中设置的布局参数都不能拿到。后面我也会专门写一篇博客来介绍布局文件被添加到activity窗口的过程,里面会讲到这个方法被调用的来龙去脉。其他几个方法我们最好也能重写一下,将里面的LayoutParams换成我们自定义的CustomLayoutParams类,避免以后会遇到布局参数类型转换异常。
public LayoutParams generateLayoutParams(AttributeSet attrs) {
return new CustomLayoutParams(getContext(), attrs);
protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) {
return new CustomLayoutParams (p);
protected LayoutParams generateDefaultLayoutParams() {
return new CustomLayoutParams (LayoutParams.MATCH_PARENT , LayoutParams.MATCH_PARENT);
protected boolean checkLayoutParams(ViewGroup.LayoutParams p) {
return p instanceof CustomLayoutP
④. 在布局文件中使用布局属性
  注意引入命名空间xmlns:openxu= "http://schemas.android.com/apk/res/包名"
&?xml version="1.0" encoding= "utf-8"?&
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:openxu= "http://schemas.android.com/apk/res/com.openxu.costomlayout"
android:background="#"
android:layout_width= "match_parent "
android:layout_height= "match_parent" &
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
openxu:layout_position= "left"
android:background= "#FF8247"
android:textColor= "#ffffff"
android:textSize="20dip"
android:padding= "20dip"
android:text= "按钮1" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
openxu:layout_position= "right"
android:background= "#8B0A50"
android:textColor= "#ffffff"
android:textSize= "18dip"
android:padding= "10dip"
android:text= "按钮2" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
openxu:layout_position= "bottom"
android:background= "#7CFC00"
android:textColor= "#ffffff"
android:textSize= "20dip"
android:padding= "15dip"
android:text= "按钮333333" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
openxu:layout_position= "rightAndBottom"
android:background= "#1E90FF"
android:textColor= "#ffffff"
android:textSize= "15dip"
android:padding= "10dip"
android:text= "按钮4" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
openxu:layout_position= "center"
android:background= "#191970"
android:textColor= "#ffffff"
android:textSize= "20dip"
android:padding= "15dip"
android:text= "按钮5" /&
⑤. 在onMeasure和onLayout中使用布局参数
  经过上面几步之后,我们运行程序,就能获取子控件的布局参数了,在onMeasure方法和onLayout方法中,我们按照自定义布局容器的特殊需求,对宽度和位置坐特殊处理。这里我们需要注意一下,如果布局容器被设置为包裹类容,我们只需要保证能将最大的子控件包裹住就ok,代码注释比较详细,就不多说了。
protected void onMeasure( int widthMeasureSpec, int heightMeasureSpec) {
int widthMode = MeasureSpec. getMode(widthMeasureSpec);
int heightMode = MeasureSpec. getMode(heightMeasureSpec);
int sizeWidth = MeasureSpec. getSize(widthMeasureSpec);
int sizeHeight = MeasureSpec. getSize(heightMeasureSpec);
int layoutWidth = 0;
int layoutHeight = 0;
measureChildren(widthMeasureSpec, heightMeasureSpec);
int cWidth = 0;
int cHeight = 0;
int count = getChildCount();
if(widthMode == MeasureSpec. EXACTLY){
layoutWidth = sizeW
for ( int i = 0; i & i++)
View child = getChildAt(i);
cWidth = child.getMeasuredWidth();
layoutWidth = cWidth & layoutWidth ? cWidth : layoutW
if(heightMode == MeasureSpec. EXACTLY){
layoutHeight = sizeH
for ( int i = 0; i & i++)
View child = getChildAt(i);
cHeight = child.getMeasuredHeight();
layoutHeight = cHeight & layoutHeight ? cHeight : layoutH
setMeasuredDimension(layoutWidth, layoutHeight);
protected void onLayout( boolean changed, int left, int top, int right,
int bottom) {
final int count = getChildCount();
int childMeasureWidth = 0;
int childMeasureHeight = 0;
CustomLayoutParams params = null;
for ( int i = 0; i & i++) {
View child = getChildAt(i);
childMeasureWidth = child.getMeasuredWidth();
childMeasureHeight = child.getMeasuredHeight();
params = (CustomLayoutParams) child.getLayoutParams();
switch (params. position) {
case CustomLayoutParams. POSITION_MIDDLE:
left = (getWidth()-childMeasureWidth)/2;
top = (getHeight()-childMeasureHeight)/2;
case CustomLayoutParams. POSITION_LEFT:
case CustomLayoutParams. POSITION_RIGHT:
left = getWidth()-childMeasureW
case CustomLayoutParams. POSITION_BOTTOM:
top = getHeight()-childMeasureH
case CustomLayoutParams. POSITION_RIGHTANDBOTTOM:
left = getWidth()-childMeasureW
top = getHeight()-childMeasureH
child.layout(left, top, left+childMeasureWidth, top+childMeasureHeight);
运行效果:
  下面几个效果分别对应布局容器宽高设置不同的属性的情况(设置match_parent 、设置200dip、设置):
      
从运行结果看,我们自定义的布局容器在各种宽高设置下都能很好的测量大小和摆放子控件。现在我们让他支持margin属性
3. 支持layout_margin属性
  如果我们自定义的布局参数类继承自MarginLayoutParams,就自动支持了layout_margin属性了,我们需要做的就是直接在布局文件中使用layout_margin属性,然后再onMeasure和onLayout中使用margin属性值测量和摆放子控件。需要注意的是我们测量子控件的时候应该调用measureChildWithMargin()方法。
布局文件:
&?xml version="1.0" encoding= "utf-8"?&
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:openxu= "http://schemas.android.com/apk/res/com.openxu.costomlayout"
android:background="#"
android:layout_width= "match_parent"
android:layout_height= "match_parent" &
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
openxu:layout_position= "left"
android:layout_marginLeft = "20dip"
android:background= "#FF8247"
android:textColor= "#ffffff"
android:textSize="20dip"
android:padding= "20dip"
android:text="按钮1" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:layout_marginTop = "30dip"
openxu:layout_position= "right"
android:background= "#8B0A50"
android:textColor= "#ffffff"
android:textSize="18dip"
android:padding= "10dip"
android:text="按钮2" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
android:layout_marginLeft = "30dip"
android:layout_marginBottom = "10dip"
openxu:layout_position= "bottom"
android:background= "#7CFC00"
android:textColor= "#ffffff"
android:textSize="20dip"
android:padding= "15dip"
android:text="按钮333333" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
openxu:layout_position= "rightAndBottom"
android:layout_marginBottom = "30dip"
android:background= "#1E90FF"
android:textColor= "#ffffff"
android:textSize="15dip"
android:padding= "10dip"
android:text="按钮4" /&
android:layout_width= "wrap_content"
android:layout_height= "wrap_content"
openxu:layout_position= "center"
android:layout_marginBottom = "30dip"
android:layout_marginRight = "30dip"
android:background= "#191970"
android:textColor= "#ffffff"
android:textSize="20dip"
android:padding= "15dip"
android:text="按钮5" /&
onMeasure和onLayout:
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthMode = MeasureSpec. getMode(widthMeasureSpec);
int heightMode = MeasureSpec. getMode(heightMeasureSpec);
int sizeWidth = MeasureSpec. getSize(widthMeasureSpec);
int sizeHeight = MeasureSpec. getSize(heightMeasureSpec);
int layoutWidth = 0;
int layoutHeight = 0;
int cWidth = 0;
int cHeight = 0;
int count = getChildCount();
for( int i = 0; i & i++){
View child = getChildAt(i);
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
CustomLayoutParams params = null;
if(widthMode == MeasureSpec. EXACTLY){
layoutWidth = sizeW
for ( int i = 0; i & i++)
View child = getChildAt(i);
cWidth = child.getMeasuredWidth();
params = (CustomLayoutParams) child.getLayoutParams();
int marginWidth = cWidth+params.leftMargin+params.rightM
layoutWidth = marginWidth & layoutWidth ? marginWidth : layoutW
if(heightMode == MeasureSpec. EXACTLY){
layoutHeight = sizeH
for ( int i = 0; i & i++)
View child = getChildAt(i);
cHeight = child.getMeasuredHeight();
params = (CustomLayoutParams) child.getLayoutParams();
int marginHeight = cHeight+params.topMargin+params.bottomM
layoutHeight = marginHeight & layoutHeight ? marginHeight : layoutH
setMeasuredDimension(layoutWidth, layoutHeight);
protected void onLayout( boolean changed, int left, int top, int right,
int bottom) {
final int count = getChildCount();
int childMeasureWidth = 0;
int childMeasureHeight = 0;
CustomLayoutParams params = null;
for ( int i = 0; i & i++) {
View child = getChildAt(i);
childMeasureWidth = child.getMeasuredWidth();
childMeasureHeight = child.getMeasuredHeight();
params = (CustomLayoutParams) child.getLayoutParams();
switch (params. position) {
case CustomLayoutParams. POSITION_MIDDLE:
left = (getWidth()-childMeasureWidth)/2 - params.rightMargin + params.leftM
top = (getHeight()-childMeasureHeight)/2 + params.topMargin - params.bottomM
case CustomLayoutParams. POSITION_LEFT:
left = 0 + params. leftM
top = 0 + params. topM
case CustomLayoutParams. POSITION_RIGHT:
left = getWidth()-childMeasureWidth - params.rightM
top = 0 + params. topM
case CustomLayoutParams. POSITION_BOTTOM:
left = 0 + params. leftM
top = getHeight()-childMeasureHeight-params.bottomM
case CustomLayoutParams. POSITION_RIGHTANDBOTTOM:
left = getWidth()-childMeasureWidth - params.rightM
top = getHeight()-childMeasureHeight-params.bottomM
child.layout(left, top, left+childMeasureWidth, top+childMeasureHeight);
运行效果:
  好了,就写到这里,如果想尝试设置其他属性,比如above、below等,感兴趣的同学可以尝试一下哦~。其实也没什么难的,无非就是如果布局属性定义的多,那么在onMeasure和onLayout中考虑的问题就更多更复杂,自定义布局容器就是根据自己的需求,让容器满足我们特殊的摆放要求。
总结一下今天学习的内容,这篇博客主要学习了两个知识点:
自定义ViewGroup的步骤:
①. 继承ViewGroup,覆盖构造方法
②. 重写onMeasure方法测量子控件和自身宽高
③. 实现onLayout方法摆放子控件
为布局容器自定义布局属性:
①. 大致明确布局容器的需求,初步定义布局属性
②. 继承LayoutParams,定义布局参数类
③. 重写获取布局参数的方法
④. 在布局文件中使用布局属性
⑤. 在onMeasure和onLayout中使用布局参数
各位童鞋有什么疑问或者建议欢迎留言,有你的支持让我们共同进步,如果觉得写的不错,那就顶我一下吧·
源码下载:
阅读:112840
文章:11篇
阅读:54706}

我要回帖

更多关于 彩充充电器是什么意思 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信