位置: 编程技术 - 正文

display getSize()

编辑:rootadmin
If you want the the display dimensions in pixels you can use getSize: Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int width = size.x; int height = size.y; If you're not in an Activity you can get the default Display via WINDOW_SERVICE: WindowManager wm = (WindowManager) ctx.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); Before getSize was introduced (in API level ), you could use the getWidth and getHeight methods that are now deprecated: Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); // deprecated int height = display.getHeight(); // deprecated

推荐整理分享display getSize(),希望有所帮助,仅作参考,欢迎阅读内容。

display getSize()

文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!

安卓学习3-布局管理-TableLayout API:

动态设置布局LayoutInflater LayoutInflater作用是将layout的xml布局文件实例化为View类对象,LayoutInflater的作用类于findViewById(),不同点是LayoutInflater是用来找layout文件夹下的xml布局文件,

欢迎使用CSDN-markdown编辑器 androidstudio编译报错:Error:(xx,x)Couldnotfindproperty'processResources'oncom.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated@xxxxxxx.解决方法:将app下的build.gradle

本文链接地址:https://www.jiuchutong.com/biancheng/385132.html 转载请保留说明!

上一篇:Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll

下一篇:安卓学习3-布局管理-TableLayout(android布局教程)

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络