支持不同的屏幕 [英] Supporting Different Screens
问题描述
我正在为 android 支持不同的屏幕我根据他们的要求创建了不同的可绘制文件夹并粘贴了图片,如下所示
im working on Supporting different Screen for android i created different drawable folders and pasted pics according to their requirments like as bellow
drawable-ldpi = 240*320 px (dimension)
drawable-mdpi = 320*480px
drawable-hdpi = 480 * 800px
drawable-xhdpi=720*1280px
然后我将粘贴布局复制到相应的布局文件夹中,例如
and then i copy paste layouts in coresponding layout folders like
layout-small
layout-normal
layout -land
layout-land-small
等等等等现在当我打开每个文件夹的activity_main(layout)时,它必须从drawable的对应文件夹中选择背景照片,但它在所有布局中只从drawable-hdpi中选择一张照片.问题出在哪里???
etc etc now when i open the activity_main(layout) of each folder,it has to select the background photo form corresponding folders of drawable,but it select only one photo from drawable-hdpi in all layouts. where is problem???
推荐答案
Android OS 自动从特定文件夹中选择 drawable.作为开发人员,您只能为每个文件夹提供不同的可绘制对象:
Android OS automatically selects drawable from specific folder. You as a developer must only provide different drawable for each folder:
drawable-xhdpi/
awesomeimage.png
drawable-hdpi/
awesomeimage.png
drawable-mdpi/
awesomeimage.png
drawable-ldpi/
awesomeimage.png
证明其有效的最佳方式是在真实设备上启动您的应用程序.您也可以在设计器中的 Android Studio 中使用不同的设备,并且应该应用来自不同 drawable 文件夹的图片:
The best way to show that it works is to launch your application on real device. You can also use different devices in Android Studio in designer and pictures from different drawable folders should be applied:
希望对您有所帮助.
这篇关于支持不同的屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!