简体   繁体   English

Android DPI在运行时更改

[英]Android DPI changes on runtime

In my app I support three different DPIs (MDPI, HDPI, XHDPI). 在我的应用程序中,我支持三种不同的DPI(MDPI,HDPI,XHDPI)。 On all of my test devices the app works just fine, except for the Galaxy Nexus (XHDPI) and Xperia Z (XXHDPI). 除了Galaxy Nexus(XHDPI)和Xperia Z(XXHDPI),该应用程序在我所有的测试设备上都可以正常运行。

When the app starts everything looks fine and well on these devices, but when a certain new Activity starts it suddenly uses the MDPI resources. 当应用启动时,在这些设备上一切正常,但是当某个新的Activity启动时,它突然使用了MDPI资源。

Is this behavior that anyone recognizes or have a solution for this? 是任何人都认识到这种行为或对此有解决方案吗? Please let me know! 请告诉我!

I already played with android:launchMode , unfortunately without any success... 我已经玩过android:launchMode ,不幸的是没有成功...

You need to use drawable-large folder for xhdpi devices like nexus. 您需要为xhdpi设备(例如nexus)使用drawable-large文件夹。 I have implemented this for my own project which had the same problem. 我已经为我自己的项目实施了这个程序,该程序存在相同的问题。 drawable-xhdpi is not detected by nexus but if you put resources in drawable-large it works fine. nexus未检测到drawable-xhdpi ,但如果将资源放在drawable-large则可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM