about android Drawable getBounds return Rect(0, 0 - 0, 0)

前端 未结 1 1904
猫巷女王i
猫巷女王i 2021-01-12 16:06

i want get the bound of drawable but then i use getBounds or copyBounds method .they all return Rect(0, 0 - 0, 0). the code like this

    Drawable marker =          


        
1条回答
  •  甜味超标
    2021-01-12 16:45

    Drawables don't have dimensions unless they've been drawn. If you want to get the size of the image you're passing in, you can create your own rect with drawable.getIntrinsicWidth() and drawable.getIntrinsicHeight()

    0 讨论(0)
提交回复
热议问题