public View getChildAt(int index)
Returns: the view at the specified position in the group. or null if the position does not exist within the group
index: the position at which to get the view from( 方法里面的参数就是布局里面层次的索引)
在一个View中调用getChildAt(int index)方法,假如这个View的布局如下:
那 getChildAt(1) 返回的是一个LinearLayout, (2)就是一个include里面的view
代码如下:
mWapper = (LinearLayout) getChildAt(0);
mMenu = (ViewGroup) getChildAt(1);
mContent = (ViewGroup) getChildAt(1);