腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(5329)
视频
沙龙
1
回答
DisplayMetrics
返回零
android
、
dpi
我想获取设备屏幕的dpi,但当我使用:我将完整的
DisplayMetrics
对象设置为零(我在调试过程中看到了)。MyWebChromeClient() {
DisplayMetrics
浏览 1
提问于2013-06-28
得票数 2
回答已采纳
2
回答
错误的widthPixels?
android
、
pixel
DisplayMetrics
displaymetrics
= new
DisplayMetrics
(); int h =
displaymetrics
.heightPixels
DisplayMetrics
displayMetric
浏览 3
提问于2011-03-11
得票数 6
2
回答
获取自定义类中显示指标的值
android
如何在自定义组件中获取
DisplayMetrics
?
浏览 0
提问于2011-11-23
得票数 1
回答已采纳
1
回答
如何为不同的设备分辨率设置以下值?
java
、
android
、
bitmap
、
set
如何为不同的设备分辨率设置以下值?我的代码如下:d.setBounds( 0, 0, 60, 60 );
浏览 4
提问于2014-03-11
得票数 0
回答已采纳
1
回答
android系统中dp到px的精确转换
android
、
pixel
public int dpToPx(int dp, Context context) { int px = Math.round(dp * (
displayMetrics
.xdpi /
DisplayMetrics
.DENSITY_DEFAULT)); }public int dpToPx(flo
浏览 0
提问于2016-08-31
得票数 0
回答已采纳
3
回答
Android,获取屏幕宽度和高度?
android
我正在尝试在Android中获取屏幕的宽度和高度,我有:getWindowManager().getDefaultDisplay().getMetrics(
displaymetrics
);stageHeight=
displaymetrics
.heightPixels; 宽度是1280,但返回到7
浏览 3
提问于2011-09-22
得票数 2
回答已采纳
1
回答
不使用SurfaceHolder获取屏幕宽度
java
、
android
、
height
、
width
、
screen
如何在不使用SurfaceHolder的情况下获得手机的宽度或高度?
浏览 0
提问于2011-08-31
得票数 0
回答已采纳
1
回答
如何在android中考虑三星Galaxy Edge的情况下准确计算ScreenSize
android
、
keyboard
、
resolution
、
dimension
realHeight; //new pleasant way to get real metrics display.getRealMetrics(realMetrics); realWidth =
浏览 0
提问于2016-03-12
得票数 0
1
回答
如何找出设备的屏幕分辨率和密度,以便在模拟器和设备上设置相同的UI显示?
android
我需要在设备和仿真器中设置相同的UI (在我的应用程序中,UI在仿真器和设备中更改),因此我需要知道设备的屏幕分辨率和密度。我不知道如何发现.Let me知道如何在设备中找到它。Lakshmanan
浏览 0
提问于2010-11-03
得票数 4
回答已采纳
4
回答
如何在android中通过编程从像素计算dp
android
、
android-layout
、
resolution
我通过以下方式获得解决方案:getWindowManager().getDefaultDisplay().getMetrics(
displaymetrics
);wt =
displaymetrics
.widthPixels;
浏览 0
提问于2011-11-28
得票数 139
回答已采纳
2
回答
计算android屏幕尺寸?
android
、
android-layout
、
mobile
方法1:getWindowManager().getDefaultDisplay().getMetrics(
displayMetrics
);int absoluteWidthInPx =
displayMetrics
.widthPixelsabsoluteHeightIn
浏览 0
提问于2012-08-29
得票数 4
回答已采纳
4
回答
正在获取屏幕大小返回%0
android
我正在尝试用下面的代码在我的模拟器(API7)上获取屏幕尺寸:现在我尝试使用scaledDensityint width = (width / ((int) scaledDensity)) / 7;java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tomer.workoutlog2/com.example.wor
浏览 1
提问于2013-08-13
得票数 1
1
回答
在活动墙纸中,我在哪里使用getWindowManager()?
java
、
android
、
live-wallpaper
我试过了:getWindowManager().getDefaultDisplay().getMetrics(
displaymetrics
); 不走运。
浏览 0
提问于2012-01-29
得票数 3
回答已采纳
1
回答
如何为API 30+获取设备显示DPI?
android
在API 30之前,您可以这样做:windowManager.defaultDisplay.getMetrics(
displayMetrics
)App.log("ScreenDensity: W - ${
displayMetrics
.xdpi}") App.log("S
浏览 16
提问于2021-12-15
得票数 0
1
回答
根据屏幕大小/ DPI动态更改editTexts位置
android
、
android-layout
、
android-edittext
、
geolocation
、
android-windowmanager
: mSearchField = (EditText)v.findViewById (R.id.something
浏览 0
提问于2017-04-03
得票数 0
1
回答
Android UiDevice getDisplayHeight()返回错误的值
android-espresso
、
android-uiautomator
displayMetrics
= new
DisplayMetrics
(); if(Build.VERSION.SDK_INT >= 17) { }return
displayMetrics
; public static Stri
浏览 3
提问于2019-12-24
得票数 0
1
回答
Android -在一个类中获得
DisplayMetrics
android
这是一堂课
DisplayMetrics
displayMetrics
= new
DisplayMetrics
); //getResourcesLog.d("
displayMetrics</e
浏览 2
提问于2016-01-14
得票数 2
回答已采纳
1
回答
如何正确计算android设备对角线?
android
、
kotlin
、
screen-size
我写道: return hypot(
displayMetrics
.widthPixels/
displayMetrics
.xdpi,
displayMetrics
.heightPixels *
displayMetrics
.ydpi)在我得到指标之前: private fun Activity.getMetrics() =
Displ
浏览 2
提问于2019-10-18
得票数 0
13
回答
Android下如何在运行时根据dp或dip来确定屏幕宽度?
android
、
density-independent-pixel
我需要使用dip/dp (在java文件中)编写android小部件的布局。在运行时,如果我编写代码,此函数返回以像素为单位的屏幕宽度(px)。为了将其转换为dp,我编写了:这似乎没有返回正确的答案。我做了屏幕分辨率为480x800的WVGA800的模拟器。当运行仿真器并让代码打印像素和dp的值时,两者都达到了320。此仿真器为240
浏览 1
提问于2011-06-24
得票数 214
3
回答
是否将物料固定底部板材高度设置为屏幕高度的一半?
java
、
android
、
material-design
我想我必须通过
DisplayMetrics
获得屏幕高度,并以某种方式将其应用于LinearLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
浏览 26
提问于2020-05-04
得票数 0
回答已采纳
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
Android 自定义View之随机数验证码
爱奇艺开源 Qigsaw,基于 Android App Bundle 的动态化框架
热门
标签
更多标签
云服务器
即时通信 IM
ICP备案
对象存储
实时音视频
活动推荐
运营活动
广告
关闭
领券