简体   繁体   English

如何设计适用于所有设备的android应用程序的UI?

[英]How to design UI for android application that will compatible for all devices?

I am developing android applications from last four months, but still i am not able to design UI which will support for maximum screens. 我从最近四个月开始开发android应用程序,但仍然无法设计支持最大屏幕的UI。 What should be my ideal layout and drawable structure and what is the good way should i follow to achieve it. 我理想的布局和可绘制结构应该是什么,我应该遵循什么好的方法来实现它。 Please help me. 请帮我。

Thanks in advance. 提前致谢。

I'll quote the top answer of this thread which is pretty much equal to your question. 我将引用此线程的最佳答案, 答案几乎等于您的问题。

That may not be possible. 那可能是不可能的。 However you can look at these links and learn how to provide different images(pixels and density), layouts and further on. 但是,您可以查看这些链接,并学习如何提供不同的图像(像素和密度),布局以及其他内容。 It may not be possible to make a userinterface on a low level density screen the same way as a high density screen and then you can target different layouts to different phones eg 可能无法以与高密度屏幕相同的方式在低密度屏幕上创建用户界面,然后可以将不同的布局定位到不同的电话,例如

Providing Resources 提供资源

Application Resources 应用资源

You should also have a look at this: Best practice supporting multiple screens . 您还应该查看以下内容: 支持多个屏幕的最佳实践

Although it is possible you should focus on a few main densities/screen sizes which you will support. 尽管可能的话,您应该关注将支持的几种主要密度/屏幕尺寸。 Test these and make sure they work as you want them to do. 对它们进行测试,并确保它们可以按您希望的方式工作。 It will be very much work to support all varieties and may not pay off because only few phones use specific sizes. 支持所有品种将是非常艰巨的工作,并且可能不会奏效,因为只有少数手机使用特定尺寸。

Well the best way to do that will be: the same icon with different sizes and put them in order in the(these are order from smaller sizes to bigger sizes): 最好的方法是:将具有不同大小的相同图标放入其中(从小到大的顺序排列):

  • mdpi 分辨率
  • ldpi 分辨率
  • hdpi 分辨率
  • xhdpi xhdpi

Th OS will automatically get you the best icon to fit the screen. 操作系统将自动为您提供适合屏幕的最佳图标。 Obviously if you want to run your apps in tablets as well it will be extremely hard to achieve a layout that can be compatible with thousands of devices available on the market. 显然,如果您也想在平板电脑上运行应用程序,那么要实现与市场上数千种设备兼容的布局将非常困难。 For that you can create different layout folders and create several of them for different screen sizes. 为此,您可以创建不同的布局文件夹,并为不同的屏幕尺寸创建多个文件夹。

For more info you should definitely see this dev page: http://developer.android.com/guide/practices/screens_support.html 有关更多信息,您绝对应该看到该开发页面: http : //developer.android.com/guide/practices/screens_support.html

Hope this helps 希望这可以帮助

Use RelativeLayout or LinearLayout with weights. 对权重使用RelativeLayoutLinearLayout So that you get same view on most on screens. 这样您就可以在大多数屏幕上获得相同的视图。 You can use one copy of images with good resolution in drawable folder that can adjust on most screens or different sizes images in different drawable folders but its increase your app size. 您可以在drawable文件夹中使用具有高分辨率的图像副本,该副本可以在大多数屏幕上调整,也可以在不同drawable文件夹中使用不同尺寸的图像,但是会增加您的应用大小。 But its always good practise to create layout depend on different sizes and some layouts based on height and width. 但是创建布局始终是一种好的做法,取决于不同的大小以及一些基于高度和宽度的布局。

Best way to implement Fragment 实现片段的最佳方法

And also use import any icon with the following steps 并通过以下步骤使用导入任何图标

  1. Right click on Project 右键单击项目
  2. select ->new -> other.. 选择->新->其他。
  3. Then choose Android Icon Set 然后选择Android图标集
  4. Launcher Icons, Icon Name 启动器图标,图标名称
  5. so on... 等等...

    You can follow this tutorial http://www.vogella.com/tutorials/AndroidFragments/article.html 您可以按照本教程http://www.vogella.com/tutorials/AndroidFragments/article.html进行操作

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

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