从DIP转换为像素 [英] Converting from dip to px

查看:242
本文介绍了从DIP转换为像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我有这个与下面的堆栈输出运行,因为它是扔了一个错误。

 资源R = getResources();
    浮PIX = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,14,r.getDisplayMetrics());>未捕获的处理程序:螺纹主力退出,由于未捕获的异常
了java.lang.RuntimeException:无法启动活动ComponentInfo {com.test.pne / com.test.pne.one}:android.content.res.Resources $ NotFoundException:字符串资源ID#0xe
在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
在android.app.ActivityThread.access $ 2100(ActivityThread.java:116)
在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1794)
在android.os.Handler.dispatchMessage(Handler.java:99)
在android.os.Looper.loop(Looper.java:123)
在android.app.ActivityThread.main(ActivityThread.java:4203)
在java.lang.reflect.Method.invokeNative(本机方法)
在java.lang.reflect.Method.invoke(Method.java:521)
在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:791)
在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
在dalvik.system.NativeStart.main(本机方法)
android.content.res.Resources $ NotFoundException:引起字符串资源ID#0xe
在android.content.res.Resources.getText(Resources.java:205)
在android.widget.TextView.setText(TextView.java:2809)
在com.quiz.max.Quiz.onCreate(Quiz.java:87)
在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
... 11更多


解决方案

我甚至不真正看到你的问题是什么,但错误好像它是由一个没有被找到字符串资源造成的(也许尝试固定Android项目的属性?)

 产生的原因:android.content.res.Resources $ NotFoundException:字符串资源ID#0xe在

也许如果你解释越多,你想要什么,我可以尝试帮助更多。

I currently have this running with the stack output below as it is throwing up an error.

    Resources r = getResources();
    float pix = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 14, r.getDisplayMetrics());

> Uncaught handler: thread main exiting due to uncaught exception
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.pne/com.test.pne.one}: android.content.res.Resources$NotFoundException: String resource ID #0xe
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
at android.app.ActivityThread.access$2100(ActivityThread.java:116)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4203)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0xe
at android.content.res.Resources.getText(Resources.java:205)
at android.widget.TextView.setText(TextView.java:2809)
at com.quiz.max.Quiz.onCreate(Quiz.java:87)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
... 11 more

解决方案

I don't even really see what your question is, but the error seems as though it's caused by a String resource that isn't being found (Maybe try Fixing Android project properties?)

Caused by: android.content.res.Resources$NotFoundException: String resource ID #0xe at 

Maybe if you explain more what you want, I can try to help more.

这篇关于从DIP转换为像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆