简体   繁体   English

Android App-创建不同的布局文件夹后屏幕尺寸未缩放

[英]Android App - Screen Size not Scaling after creating different layout folders

I have been trying to make my Android app scale to different screens. 我一直在尝试使我的Android应用程序缩放到不同的屏幕。 Therefore I read about this in the Android guides and found that I needed to make different size images and different layout folders. 因此,我在Android指南中阅读了此内容,发现需要制作不同尺寸的图像和不同的布局文件夹。

I made different layout folders and played around with the XML files until I got it to display something I was happy with on a different size screen. 我创建了不同的布局文件夹,并使用XML文件,直到我将其显示在不同尺寸的屏幕上为止。

Also, I changed my images into the different formats (eg xhdpi and mdpi). 另外,我将图像更改为不同的格式(例如xhdpi和mdpi)。 I was a little confused about this, since I don't know what pixel sizes are what in comparison to mdpi (for example is 100x100 an xhdpi or an mdpi?) 我对此有些困惑,因为我不知道与mdpi相比像素大小是什么(例如,xhdpi或mdpi是100x100?)

Anyway, when I run my app on different size phones it doesn't change layout. 无论如何,当我在不同尺寸的手机上运行我的应用程序时,它不会更改布局。 Is there something I need to write in my java code (in the activity file) to make it change layout? 我需要在我的Java代码中(在活动文件中)编写一些东西来使其更改布局吗?

Thanks in advance! 提前致谢!

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

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