计算器应用在相同屏幕尺寸但DPI不同(420 DPI与480 DPI)上的布局不同 [英] Calculator app different layout on same screen size but different DPI (420 DPI vs 480 DPI)

查看:436
本文介绍了计算器应用在相同屏幕尺寸但DPI不同(420 DPI与480 DPI)上的布局不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做了一个非常简单的计算器布局.但是我的手机上480 DPI和420 DPI有所不同.在420DPI中,屏幕右侧有可用空间,并且按钮比480DPI细.我将dp用作按钮的度量单位,将sp用作文本的度量单位.

I have made this very simple calculator layout. But its different for 480 DPI and 420 DPI on my phone. There is free space on right part of screen in 420DPI and buttons are thinner than 480DPI. I used dp as a units of measurements for buttons and sp for text.

我阅读了支持不同的屏幕尺寸| Android开发人员 但不能真正解决我的问题.

I read Supporting Different Screen Sizes | Android Developers but couldn't really solve my problem.

我已阅读dp单位独立于屏幕的DPI,并且按钮将动态缩放.那么,即使我以dp为单位,在不同的DPI上我的按钮也变得越来越细?

I have read that dp unit is independent of DPI of the screen and buttons will scale up or down dynamically. Then how come my buttons get thinner on different DPI even after i used dp as an unit?

推荐答案

我将文件放在res文件夹中,文件名为values-w410dp,因为Nexus 5X 1920 x 1080 px(730 x 410 dp)正常420 dpi.

I put a file in res folder, the file name is values-w410dp ,because Nexus 5X 1920 x 1080 px (730 x 410 dp) normal 420 dpi.

您可以尝试.它可以控制布局.

You can try. It can control layout.

这篇关于计算器应用在相同屏幕尺寸但DPI不同(420 DPI与480 DPI)上的布局不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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