平常获取设备的宽高无非就那几 <script language="javascript"> var h = ""; h += " 网页可见区域宽:"+ document.body.clientWidth; h += " 网页可见区域高:"+ document.body.clientHeight; h += " 网页可见区域宽:"+ document.body.offsetWidth +"…
int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); view.measure(w,h); int width = view.getMeasuredWidth(); int height = view.getMeasuredHeight(); 当我们在布…
## 获取内联样式宽高 只能获取内联设置的样式,在style或者.css文件中设置的无法获取 let div = document.querySelect('.test'); let width = div.style.width let height = div.style.height ## currentStyle和getComputedStyle获取所有样式 两者只能获取样式,不能设置样式 let div = document.querySelect('.test'); let widt…