0

I have a custom view that I'm using canvas to be able to draw on it what I want, this view inside a scrollview that take match_parent for each width and height and also my custom view take match_parent for each width and height

I want to know the size of the scrollview to be able to draw only inside the available space that I have

I have tried onLayout, onMeasure but nothing works with me

Can any one please help?

Kara
  • 6,115
  • 16
  • 50
  • 57
Amira Elsayed Ismail
  • 9,216
  • 30
  • 92
  • 175
  • try below link http://stackoverflow.com/questions/3656139/android-get-height-of-the-parent-layouut – Yogendra Dec 22 '13 at 16:15
  • I have used display matrix to get all screen width and height, but it make a great problem when I add my custom view with another controls above and bellow it, my control is not showing complete – Amira Elsayed Ismail Dec 22 '13 at 16:24
  • see Canvas.getClipBounds method – pskink Dec 22 '13 at 16:33
  • Actually I'm drawing on bitmap to speed up the scrolling of my view, so in the first of my draw method I create the bitmap with my display matrix width and height and then create a canvas from that bitmap, so I think this will not work with me – Amira Elsayed Ismail Dec 22 '13 at 16:48
  • I have found this link http://stackoverflow.com/questions/9845197/android-get-fragment-width, and it gives my the width and height of my fragment, but it draw an empty fragment, can any one tell me what is the problem ? – Amira Elsayed Ismail Dec 23 '13 at 09:58

1 Answers1

0

I have solved this problem using

onGlobalLayout Method, and I also inherit Viewgroup not View and implement onLayoutMethod, to make element shown in my fragement

Thanks all

Amira Elsayed Ismail
  • 9,216
  • 30
  • 92
  • 175