简体   繁体   English

什么是使用本地android组件制作将成为android中的级别选择器的2D地图的最佳方法?

[英]What is best best approach to make a 2D map that will be a level selector in android using native android components?

I need to make a 2d map which lays out levels for a android game. 我需要制作一个二维地图,其中列出了Android游戏的等级。 It is low budget and I need to make it with native android components. 它的预算很低,我需要使用本地android组件来制作。

The map goes to a finite number of levels so I do not have to generate the map dynamically and using the technology suggested in http://forum.unity3d.com/threads/smart-2d-levels-map.267394/ will be a bit of a over kill. 该地图将转到有限数量的级别,因此我不必动态生成地图,而无需使用http://forum.unity3d.com/threads/smart-2d-levels-map.267394/中建议的技术有点过头了。

I also got a heap of motivation from How to create a 2D Map to use in a Android Game? 我还从如何创建2D地图以用于Android游戏中获得了很多动力 as they said that it is possible to achieve what I need without a engine. 正如他们所说,无需引擎即可实现我所需要的。

All I am enquiring about is if I should make a scroll view with a relative layout inside and then align the real buttons relative to each other in px (as dp will make that the images will not line up in all cases as the background which is a image is in px) or should I approach this completely differently. 我要问的是是否要在滚动视图中使用相对布局,然后将实际按钮相对于彼此对齐(以px为单位)(因为dp会使图像在所有情况下都不会与背景对齐)图片以px为单位),或者我应该采用完全不同的方法。

My biggest concern with my initial thought out approach is that the different screens will mess with the locations of the buttons and that if I make everything px that the screen will be to small for high density screens. 我最初考虑的方法最大的担忧是,不同的屏幕将使按钮的位置混乱,并且如果我将所有像素设置为px,则对于高密度屏幕,屏幕将变小。

I have considered to make different layout files for the different screen sizes but before I start developing I thought that it will be best to get another view point from the community 我曾考虑为不同的屏幕尺寸制作不同的布局文件,但是在开始开发之前,我认为最好从社区中获取另一个观点。

Thanks in advance for the feedback. 在此先感谢您的反馈。

I have played around with using a relative layout and this seems to work on all screen sized after I set the height and width to static dp values. 我已经尝试过使用相对布局,并且在将高度和宽度设置为静态dp值之后,这似乎可以在所有屏幕尺寸上使用。 This makes the ratio constant and makes the solution acceptable on any screen size 这使得比率恒定,并使解决方案在任何屏幕尺寸上都可以接受

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

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