Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  2.  
  3. super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  4.  
  5.  
  6. int aMeasuredWidth = MeasureSpec.makeMeasureSpec(getMeasuredWidth(),
  7. MeasureSpec.EXACTLY);
  8. int aMeasuredHeight = MeasureSpec.makeMeasureSpec(getMeasuredHeight(),
  9. MeasureSpec.EXACTLY);
  10.  
  11. for (int aChildIndex = 0; aChildIndex < getChildCount(); aChildIndex++) {
  12. View aChildView = getChildAt(aChildIndex);
  13.  
  14. aChildView.measure(MeasureSpec.makeMeasureSpec(aMeasuredWidth,
  15. MeasureSpec.UNSPECIFIED), aMeasuredHeight);
  16.  
  17. }
  18.  
  19. }
  20.  
  21. protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  22.  
  23. int size = getChildCount();
  24. int width = MeasureSpec.makeMeasureSpec(widthMeasureSpec,
  25. MeasureSpec.UNSPECIFIED);
  26. int height = MeasureSpec.makeMeasureSpec(heightMeasureSpec,
  27. MeasureSpec.UNSPECIFIED);
  28.  
  29. Log.e("CHILD COUNT", " " + size);
  30. for (int i = 0; i < size; ++i) {
  31. final View child = getChildAt(i);
  32.  
  33. if (child.getVisibility() != GONE) {
  34. measureChild(child, widthMeasureSpec, heightMeasureSpec);
  35. child.measure(width, height);
  36. }
  37.  
  38. }
  39.  
  40. super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement