前言:我最大的梦想,就是有一天。等老了坐在摇椅上回望一生,有故事给孩子们讲……。

相关文章:

Android自己定义控件三部曲文章索引》:http://blog.csdn.net/harvic880925/article/details/50995268

经过上篇的铺垫。这篇就開始正式開始FlowLayout的开发啦,还是先给大家上上效果:

从效果图中能够看到,底部container的布局方式应该是layout_width="match_parent",layout_height="wrap_content";
好了,废话不多说了,以下開始进入正规。

一、XML布局

从布局图中能够看到。FlowLayout中包括了非常多TextView.难度不大,布局代码例如以下:
先定义一个style,这是为FlowLayout中的TextView定义的:

  1. <style name="text_flag_01">
  2. <item name="android:layout_width">wrap_content</item>
  3. <item name="android:layout_height">wrap_content</item>
  4. <item name="android:layout_margin">4dp</item>
  5. <item name="android:background">@drawable/flag_01</item>
  6. <item name="android:textColor">#ffffff</item>
  7. </style>

注意,注意!!!我们这里定义了margin。还记得上篇中怎么样提取Margin值吗?重写generateLayoutParams()函数。

以下看activity_main.xml的布局代码:

  1. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2. xmlns:tools="http://schemas.android.com/tools"
  3. android:layout_width="match_parent"
  4. android:layout_height="match_parent"
  5. tools:context=".MainActivity">
  6.  
  7. <com.example.harvic.myapplication.FlowLayout
  8. android:layout_width="match_parent"
  9. android:layout_height="wrap_content"
  10. android:background="#ff00ff">
  11.  
  12. <TextView
  13. style="@style/text_flag_01"
  14. android:background="@drawable/flag_03"
  15. android:text="Welcome"
  16. android:textColor="#43BBE7" />
  17.  
  18. <TextView
  19. style="@style/text_flag_01"
  20. android:background="@drawable/flag_03"
  21. android:text="ITproject师"
  22. android:textColor="#43BBE7" />
  23.  
  24. <TextView
  25. style="@style/text_flag_01"
  26. android:background="@drawable/flag_03"
  27. android:text="我真是能够的"
  28. android:textColor="#43BBE7" />
  29.  
  30. <TextView
  31. style="@style/text_flag_01"
  32. android:background="@drawable/flag_03"
  33. android:text="你认为呢"
  34. android:textColor="#43BBE7" />
  35.  
  36. <TextView
  37. style="@style/text_flag_01"
  38. android:background="@drawable/flag_03"
  39. android:text="不要仅仅知道挣钱"
  40. android:textColor="#43BBE7" />
  41.  
  42. <TextView
  43. style="@style/text_flag_01"
  44. android:background="@drawable/flag_03"
  45. android:text="努力ing"
  46. android:textColor="#43BBE7" />
  47.  
  48. <TextView
  49. style="@style/text_flag_01"
  50. android:background="@drawable/flag_03"
  51. android:text="I thick i can"
  52. android:textColor="#43BBE7" />
  53.  
  54. </com.example.harvic.myapplication.FlowLayout>
  55. </LinearLayout>

这里注意两点。FlowLayout的android:layout_width设置为"match_parent"。android:layout_height设置为""wrap_content";同一时候,我们为FlowLayout加入背景来明显看出我们计算出来的所占区域大小。

二、提取margin与onMeasure()重写

1、提取margin

上篇我们讲过要提取margin,就一定要重写generateLayoutParams

  1. @Override
  2. protected LayoutParams generateLayoutParams(LayoutParams p)
  3. {
  4. return new MarginLayoutParams(p);
  5. }
  6.  
  7. @Override
  8. public LayoutParams generateLayoutParams(AttributeSet attrs)
  9. {
  10. return new MarginLayoutParams(getContext(), attrs);
  11. }
  12.  
  13. @Override
  14. protected LayoutParams generateDefaultLayoutParams()
  15. {
  16. return new MarginLayoutParams(LayoutParams.MATCH_PARENT,
  17. LayoutParams.MATCH_PARENT);
  18. }

具体为什么我们就不再讲了。上篇已经讲的非常熟悉了,以下就看看怎样在onMeasure()中计算当前container所占的位置大小。

2、重写onMeasure()——计算当前FlowLayout所占的宽高

这里就要重写onMeasure()函数。在当中计算全部当前container所占的大小。
要做FlowLayout,首先涉及以下几个问题:
(1)何时换行
从效果图中能够看到。FlowLayout的布局是一行行的,假设当前行已经放不下下一个控件。那就把这个控件移到下一行显示。

所以我们要有个变量来计算当前行已经占领的宽度,以推断剩下的空间是否还能容得下下一个控件。

(2)、怎样得到FlowLayout的宽度
FlowLayout的宽度是全部行宽度的最大值。所以我们要记录下每一行的所占领的宽度值,进而找到全部值中的最大值。
(3)、怎样得到FlowLayout的高度
非常显然,FlowLayout的高度是每一行高度的总和,而每一行的高度则是取该行中全部控件高度的最大值。

原理到这里就讲完了,以下看看代码:

(1)首先,刚进来的时候是利用MeasureSpec获取系统建议的数值的模式

  1. protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  2. super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  3. int measureWidth = MeasureSpec.getSize(widthMeasureSpec);
  4. int measureHeight = MeasureSpec.getSize(heightMeasureSpec);
  5. int measureWidthMode = MeasureSpec.getMode(widthMeasureSpec);
  6. int measureHeightMode = MeasureSpec.getMode(heightMeasureSpec);
  7. ………………
  8. }

(2)然后,是计算FlowLayout所占用的空间大小
先申请几个变量:

  1. int lineWidth = 0;//记录每一行的宽度
  2. int lineHeight = 0;//记录每一行的高度
  3. int height = 0;//记录整个FlowLayout所占高度
  4. int width = 0;//记录整个FlowLayout所占宽度

然后開始计算:(先贴出代码,再细讲)

  1. int count = getChildCount();
  2. for (int i=0;i<count;i++){
  3. View child = getChildAt(i);
  4. measureChild(child,widthMeasureSpec,heightMeasureSpec);
  5.  
  6. MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
  7. int childWidth = child.getMeasuredWidth() + lp.leftMargin +lp.rightMargin;
  8. int childHeight = child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
  9.  
  10. if (lineWidth + childWidth > measureWidth){
  11. //须要换行
  12. width = Math.max(lineWidth,childWidth);
  13. height += lineHeight;
  14. //因为因为盛不下当前控件。而将此控件调到下一行,所以将此控件的高度和宽度初始化给lineHeight、lineWidth
  15. lineHeight = childHeight;
  16. lineWidth = childWidth;
  17. }else{
  18. // 否则累加值lineWidth,lineHeight取最大高度
  19. lineHeight = Math.max(lineHeight,childHeight);
  20. lineWidth += childWidth;
  21. }
  22.  
  23. //最后一行是不会超出width范围的,所以要单独处理
  24. if (i == count -1){
  25. height += lineHeight;
  26. width = Math.max(width,lineWidth);
  27. }
  28.  
  29. }

在整个For循环遍历每一个控件时,先计算每一个子控件的宽和高,代码例如以下:

  1. View child = getChildAt(i);
  2. measureChild(child,widthMeasureSpec,heightMeasureSpec);
  3.  
  4. MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
  5. int childWidth = child.getMeasuredWidth() + lp.leftMargin +lp.rightMargin;
  6. int childHeight = child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;

注意我们在计算控件高度和宽度时,要加上上、下、左、右的margin值。
这里一定要注意的是:在调用child.getMeasuredWidth()、child.getMeasuredHeight()之前,一定要调用measureChild(child,widthMeasureSpec,heightMeasureSpec);!!!

。在上篇中我们讲过。在onMeasure()之后才干调用getMeasuredWidth()获得值。相同。仅仅有调用onLayout()后,getWidth()才干获取值。

以下就是推断当前控件是否换行及计算出最大高度和宽度了:

  1. if (lineWidth + childWidth > measureWidth){
  2. //须要换行
  3. width = Math.max(lineWidth,width);
  4. height += lineHeight;
  5. //因为因为盛不下当前控件。而将此控件调到下一行。所以将此控件的高度和宽度初始化给lineHeight、lineWidth
  6. lineHeight = childHeight;
  7. lineWidth = childWidth;
  8. }else{
  9. // 否则累加值lineWidth,lineHeight取最大高度
  10. lineHeight = Math.max(lineHeight,childHeight);
  11. lineWidth += childWidth;
  12. }

因为lineWidth是用来累加当前行的总宽度的,所以当lineWidth + childWidth > measureWidth时就表示已经容不下当前这个控件了。这个控件就须要转到下一行;我们先看else部分,即不换行时怎么办?
在不换行时。计算出当前行的最大高度。同一时候将当前子控件的宽度累加到lineWidth上:

  1. lineHeight = Math.max(lineHeight,childHeight);
  2. lineWidth += childWidth;

当须要换行时,首先将当前行宽lineWidth与眼下的最大行宽width比較计算出最新的最大行宽width,作为当前FlowLayout所占的宽度。还要将行高lineHeight累加到height变量上,以便计算出FlowLayout所占的总高度。

  1. width = Math.max(lineWidth,width);
  2. height += lineHeight;

以下就是又一次初始化lineWidth和lineHeight了。因为换行。那当前控件就是下一行控件的第一个控件,那么当前行的行高就是这个控件的高,当前行的行宽就是这个控件的宽度值了:

  1. lineHeight = childHeight;
  2. lineWidth = childWidth;

非常须要注意的是,当计算最后一行时,因为肯定是不会超过行宽的,而我们在for循环中,当不超过行宽中仅仅做了以下处理:

  1. //上面if语句的else部分
  2. }else{
  3. // 否则累加值lineWidth,lineHeight取最大高度
  4. lineHeight = Math.max(lineHeight,childHeight);
  5. lineWidth += childWidth;
  6. }

在这里。我们仅仅计算了行宽和行高,但并没有将其width和height做计算,所以,当是最后一行的最后一个控件时,我们要单独运算width、height:

  1. //最后一行是不会超出width范围的。所以要单独处理
  2. if (i == count -1){
  3. height += lineHeight;
  4. width = Math.max(width,lineWidth);
  5. }

(3)最后,通过setMeasuredDimension()设置到系统中:

  1. setMeasuredDimension((measureWidthMode == MeasureSpec.EXACTLY) ? measureWidth
  2. : width, (measureHeightMode == MeasureSpec.EXACTLY) ? measureHeight
  3. : height);

完整的代码例如以下:

  1. protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  2. super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  3. int measureWidth = MeasureSpec.getSize(widthMeasureSpec);
  4. int measureHeight = MeasureSpec.getSize(heightMeasureSpec);
  5. int measureWidthMode = MeasureSpec.getMode(widthMeasureSpec);
  6. int measureHeightMode = MeasureSpec.getMode(heightMeasureSpec);
  7.  
  8. int lineWidth = 0;
  9. int lineHeight = 0;
  10. int height = 0;
  11. int width = 0;
  12. int count = getChildCount();
  13. for (int i=0;i<count;i++){
  14. View child = getChildAt(i);
  15. measureChild(child,widthMeasureSpec,heightMeasureSpec);
  16.  
  17. MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
  18. int childWidth = child.getMeasuredWidth() + lp.leftMargin +lp.rightMargin;
  19. int childHeight = child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin;
  20.  
  21. if (lineWidth + childWidth > measureWidth){
  22. //须要换行
  23. width = Math.max(lineWidth,width);
  24. height += lineHeight;
  25. //因为因为盛不下当前控件,而将此控件调到下一行,所以将此控件的高度和宽度初始化给lineHeight、lineWidth
  26. lineHeight = childHeight;
  27. lineWidth = childWidth;
  28. }else{
  29. // 否则累加值lineWidth,lineHeight取最大高度
  30. lineHeight = Math.max(lineHeight,childHeight);
  31. lineWidth += childWidth;
  32. }
  33.  
  34. //最后一行是不会超出width范围的,所以要单独处理
  35. if (i == count -1){
  36. height += lineHeight;
  37. width = Math.max(width,lineWidth);
  38. }
  39.  
  40. }
  41. //当属性是MeasureSpec.EXACTLY时,那么它的高度就是确定的,
  42. // 仅仅有当是wrap_content时。依据内部控件的大小来确定它的大小时。大小是不确定的,属性是AT_MOST,此时,就须要我们自己计算它的应当的大小,并设置进去
  43. setMeasuredDimension((measureWidthMode == MeasureSpec.EXACTLY) ?
  44.  
  45. measureWidth
  46. : width, (measureHeightMode == MeasureSpec.EXACTLY) ?
  47.  
  48. measureHeight
  49. : height);
  50. }

3、重写onLayout()——布局全部子控件

在onLayout()中就是一个个布局子控件了,因为控件要后移和换行,所以我们要标记当前控件的left坐标和top坐标,所以我们要先申请以下几个变量:

  1. protected void onLayout(boolean changed, int l, int t, int r, int b) {
  2. int count = getChildCount();
  3. int lineWidth = 0;//累加当前行的行宽
  4. int lineHeight = 0;//当前行的行高
  5. int top=0,left=0;//当前坐标的top坐标和left坐标
  6. ………………
  7. }

然后就是计算每一个控件的top坐标和left坐标,然后调用layout(int left,int top,int right,int bottom)来布局每一个子控件,代码例如以下:(先列出来全部代码。然后再细讲)

  1. for (int i=0; i<count;i++){
  2. View child = getChildAt(i);
  3. MarginLayoutParams lp = (MarginLayoutParams) child
  4. .getLayoutParams();
  5. int childWidth = child.getMeasuredWidth()+lp.leftMargin+lp.rightMargin;
  6. int childHeight = child.getMeasuredHeight()+lp.topMargin+lp.bottomMargin;
  7.  
  8. if (childWidth + lineWidth >getMeasuredWidth()){
  9. //假设换行
  10. top += lineHeight;
  11. left = 0;
  12. lineHeight = childHeight;
  13. lineWidth = childWidth;
  14. }else{
  15. lineHeight = Math.max(lineHeight,childHeight);
  16. lineWidth += childWidth;
  17. }
  18. //计算childView的left,top,right,bottom
  19. int lc = left + lp.leftMargin;
  20. int tc = top + lp.topMargin;
  21. int rc =lc + child.getMeasuredWidth();
  22. int bc = tc + child.getMeasuredHeight();
  23. child.layout(lc, tc, rc, bc);
  24. //将left置为下一子控件的起始点
  25. left+=childWidth;
  26. }

(1)首先,与onMeasure()一样,先计算出当前孩子的宽和高:

  1. View child = getChildAt(i);
  2. MarginLayoutParams lp = (MarginLayoutParams) child.getLayoutParams();
  3. int childWidth = child.getMeasuredWidth()+lp.leftMargin+lp.rightMargin;
  4. int childHeight = child.getMeasuredHeight()+lp.topMargin+lp.bottomMargin;

(2)然后依据是否要换行来计算当行控件的top坐标和left坐标:

  1. if (childWidth + lineWidth >getMeasuredWidth()){
  2. //假设换行,当前控件将跑到下一行。从最左边開始。所以left就是0,而top则须要加上上一行的行高。才是这个控件的top点;
  3. top += lineHeight;
  4. left = 0;
  5. //相同。又一次初始化lineHeight和lineWidth
  6. lineHeight = childHeight;
  7. lineWidth = childWidth;
  8. }else{
  9. // 否则累加值lineWidth,lineHeight取最大高度
  10. lineHeight = Math.max(lineHeight,childHeight);
  11. lineWidth += childWidth;
  12. }

在计算好left,top之后。然后分别计算出控件应该布局的上、下、左、右四个点坐标:
须要非常注意的是margin不是padding,margin的距离是不绘制的控件内部的,而是控件间的间隔!

  1. int lc = left + lp.leftMargin;//左坐标+左边距是控件的開始位置
  2. int tc = top + lp.topMargin;//相同,顶坐标加顶边距
  3. int rc =lc + child.getMeasuredWidth();
  4. int bc = tc + child.getMeasuredHeight();
  5. child.layout(lc, tc, rc, bc);

最后。计算下一坐标的位置:因为在换行时才会变更top坐标。所以在一个控件绘制结束时,仅仅须要变更left坐标就可以:

  1. //将left置为下一子控件的起始点
  2. left+=childWidth;

到这里就结束了。onLayout的完整代码例如以下:

  1. protected void onLayout(boolean changed, int l, int t, int r, int b) {
  2. int count = getChildCount();
  3. int lineWidth = 0;
  4. int lineHeight = 0;
  5. int top=0,left=0;
  6. for (int i=0; i<count;i++){
  7. View child = getChildAt(i);
  8. MarginLayoutParams lp = (MarginLayoutParams) child
  9. .getLayoutParams();
  10. int childWidth = child.getMeasuredWidth()+lp.leftMargin+lp.rightMargin;
  11. int childHeight = child.getMeasuredHeight()+lp.topMargin+lp.bottomMargin;
  12.  
  13. if (childWidth + lineWidth >getMeasuredWidth()){
  14. //假设换行,当前控件将跑到下一行,从最左边開始,所以left就是0,而top则须要加上上一行的行高,才是这个控件的top点;
  15. top += lineHeight;
  16. left = 0;
  17. //相同。又一次初始化lineHeight和lineWidth
  18. lineHeight = childHeight;
  19. lineWidth = childWidth;
  20. }else{
  21. lineHeight = Math.max(lineHeight,childHeight);
  22. lineWidth += childWidth;
  23. }
  24. //计算childView的left,top,right,bottom
  25. int lc = left + lp.leftMargin;
  26. int tc = top + lp.topMargin;
  27. int rc =lc + child.getMeasuredWidth();
  28. int bc = tc + child.getMeasuredHeight();
  29. child.layout(lc, tc, rc, bc);
  30. //将left置为下一子控件的起始点
  31. left+=childWidth;
  32. }
  33.  
  34. }

好啦,有关FlowLayout的系列文章到这里就结束了,这里主要涉及到ViewGroup的绘制流程的相关知识。希望大家能掌握。

这篇文章感觉有点乱。难度倒是不大,凡是跟代码有关的东东总是非常难驾驭。可能还是语文不行啊,大家见量,多看看源代码吧,理解了上一篇之后,这篇难度不大。

源代码在文章底部给出

參考文章:

1、《Android学习笔记]View的measure过程学习》

2、《Android中measure过程、WRAP_CONTENT具体解释以及xml布局文件解析流程浅析(下)》

3、《【Android】ViewGroup全面分析》

4、《安卓冷知识:LayoutParams》

5、《MeasureSpec介绍及使用具体解释》

6、《Android 自己定义ViewGroup 实战篇 -> 实现FlowLayout》

7、《Android中View绘制流程以及invalidate()等相关方法分析》

8、《android中onMeasure初看,深入理解布局之中的一个!》

9、《MeasureSpec中的測量模式和match_parent、wrap_content是什么相应关系?》

10、《Android视图绘制流程全然解析,带你一步步深入了解View(二)》

11、《通过重写ViewGroup学习onMeasure()和onLayout()方法》

12、《Android开发实践:自己定义ViewGroup的onLayout()分析》

假设本文有帮到你。记得加关注哦

源代码下载地址:http://download.csdn.net/detail/harvic880925/8928371

请大家尊重原创者版权,转载请标明出处:http://blog.csdn.net/harvic880925/article/details/47035455  ,谢谢

自己定义控件三部曲视图篇(二)——FlowLayout自适应容器实现的更多相关文章

  1. 自己定义控件三部曲之动画篇(七)——ObjectAnimator基本使用

    前言: 假如生活欺骗了你, 不要悲伤,不要心急! 忧郁的日子里须要镇静: 相信吧,快乐的日子终将会来临! 心儿永远向往着未来: 如今却常是忧郁. 一切都是瞬息,一切都将会过去: 而那过去了的,就会成为 ...

  2. 自己定义控件三部曲之动画篇(十三)——实现ListView Item进入动画

    前言:宝剑锋从磨砺出,梅花香自苦寒来 相关文章: <Android自己定义控件三部曲文章索引>: http://blog.csdn.net/harvic880925/article/det ...

  3. WPF 4 DataGrid 控件(进阶篇二)

    原文:WPF 4 DataGrid 控件(进阶篇二)      上一篇<WPF 4 DataGrid 控件(进阶篇一)>中我们通过DataGridTemplateColumn 类自定义编辑 ...

  4. Android 自己定义控件开发入门(二)

    上一次我们讲了一堆实现自己定义控件的理论基础.列举了View类一些能够重写的方法,我们对这些方法的重写是我们继承View类来派生自己定义控件的关键 我通过一个最简单的样例给大家展示了这一个过程,不管是 ...

  5. android--------自定义控件 之 方法篇

    前面简单的讲述了Android中自定义控件的理论和流程图,今天通过代码来详细的讲解一下其中的方法 首先先创建一个类 CircularView 继承于 View,之后实现构造方法(初始化步骤) publ ...

  6. android--------自定义控件 之 属性篇

    上篇介绍了自定义控件的一个简单案例,本篇文章主要介绍如何给自定义控件自定义一些属性. Android 中使用自定义属性的一般步骤: 定义declare-styleable,添加attr 使用Typed ...

  7. Android自己定义控件系列二:自己定义开关button(一)

    这一次我们将会实现一个完整纯粹的自己定义控件,而不是像之前的组合控件一样.拿系统的控件来实现.计划分为三部分:自己定义控件的基本部分,自己定义控件的触摸事件的处理和自己定义控件的自己定义属性: 以下就 ...

  8. Android自己定义控件系列三:自己定义开关button(二)

    接上一篇自己定义开关button(一)的内容继续.上一次实现了一个开关button的基本功能.即自己定义了一个控件.开关button,实现了点击切换开关状态的功能.今天我们想在此基础之上.进一步实现触 ...

  9. Android经常使用自己定义控件(二)

           经常使用的Android自己定义控件分享 http://www.see-source.com//androidwidget/list.html?type=&p=1

随机推荐

  1. BZOJ1588 [HNOI2002]营业额统计 splay模板

    1588: [HNOI2002]营业额统计 Time Limit: 5 Sec  Memory Limit: 162 MB Submit: 16189  Solved: 6482 [Submit][S ...

  2. object的hashCode与equals

    JAVA代码:    public static void main(String[] args)    {        Object obj1 = new Object();        Obj ...

  3. Cookie和Session在Node.JS中的实践(一)

    Cookie和Session在Node.JS中的实践(一) Cookie和Session是一个非常有趣的概念,也是一个老生常谈的话题.然而,作者看了许多文章,也翻看了几本书籍,它们对Cookie和Se ...

  4. Java线程同步:synchronized锁住的是代码还是对象

    所以我们在用synchronized关键字的时候,能缩小代码段的范围就尽量缩小,能在代码段上加同步就不要再整个方法上加同步.这叫减小锁的粒度,使代码更大程度的并发.原因是基于以上的思想,锁的代码段太长 ...

  5. Akka Cluster之集群分片

    一.介绍  当您需要在集群中的多个节点之间分配Actor,并希望能够使用其逻辑标识符与它们进行交互时,集群分片是非常有用的.你无需关心Actor在集群中的物理位置,因为这可能也会随着时间的推移而发生变 ...

  6. Matlab绘图时横坐标重叠怎么办

    如横坐标重叠了,咋回事?蛋疼. 后来发现plot里已经横坐标1到50了,我又写了个 set(gca,'XTick',1:1:50);没写XTickLabel,后来我把XTick注视了就好了.

  7. selenium 定位元素方式大全

    starts-with 顾名思义,匹配一个属性开始位置的关键字 contains 匹配一个属性值中包含的字符串 text() 匹配的是显示文本信息,此处也可以用来做定位用 eg //input[sta ...

  8. Linux学习之一-从三个重要人物的故事和一张思维导图说起

    Linux是一套自由加开放源代码的类Unix操作系统,诞生于1991年10月5日(第一次正式向外公布),由芬兰学生Linus Torvalds和后来陆续加入的众多爱好者共同开发完成. Linux是一个 ...

  9. nginx资源争夺问题

    nginx资源争夺问题 多个配置之间存在资源争夺的情况,需要进行整理: 学习了:https://blog.csdn.net/veryisjava/article/details/72917894 ng ...

  10. 黑马程序猿——JAVA高新技术——反射

    ----------android培训.java培训.java学习型技术博客.期待与您交流!------------ 一.对于反射的概念 对于JAVA反射机制是在执行状态中,对于随意一个类.都可以知道 ...