Android 获得ImageView中Image的绘制大小
生活随笔
收集整理的這篇文章主要介紹了
Android 获得ImageView中Image的绘制大小
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>
ImageView在顯示圖片的時(shí)候,受限于屏幕大小,和圖片寬高。通常圖片是被縮放過,且不是寬和高都充滿ImageView的。
此時(shí),我們?nèi)绾潍@得Image被實(shí)際繪制的寬高呢?
//獲得ImageView中Image的真實(shí)寬高,通過getDrawable().getBounds()
ImageView iv = new ImageView(this);
int?dw?=?iv.getDrawable().getBounds().width();??
int?dh?=?iv.getDrawable().getBounds().height();?
轉(zhuǎn)載于:https://my.oschina.net/u/990728/blog/535551
總結(jié)
以上是生活随笔為你收集整理的Android 获得ImageView中Image的绘制大小的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ios 开发日记 21 -自动处理键盘事
- 下一篇: Android Ion 框架 文件下载