Android方向基本问题
我是安卓编程新手。我的布局文件中有一个背景,顶部有一些图像按钮。当手机方向改变时,我不希望背景改变方向,但我希望图像按钮适当旋转。获得此功能的最佳方式是什么?
我还想知道 hdpi、mdpi 和 ldpi 背景图像的分辨率。如果我为每个像素保持相同的像素大小有什么关系吗?
I am new to android programming. I have a background in my layout file and some image buttons on top. When the orientation of the phone is changed, I dont want the background to change orientation, but I want the image buttons to rotate appropriately. What is the best way to get this functionality?
Also I want to know the resolution of the images for the background for hdpi, mdpi and ldpi. Does it matter if I keep the same pixel size for each of them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在此处阅读有关旋转的信息:http://developer.android。 com/resources/articles/faster-screen-orientation-change.html
hdpi、mdpi 和 ldpi 有多种不同的分辨率。 http://developer.android.com/resources/dashboard/screens.html - 在这里您可以看到最受欢迎的尺寸和密度。但是,您可以专门为您需要的分辨率创建布局(即为具有不同分辨率的 hdpi 设备创建多个布局)。最流行的分辨率是 320x480、800x480、854x480(我通常使用与 800x480 相同的布局)。
您可以在此处阅读有关支持多个屏幕的信息: http://developer.android.com/guide/实践/screens_support.html
You can read about rotation here: http://developer.android.com/resources/articles/faster-screen-orientation-change.html
There is variety of different resolution for hdpi, mdpi and ldpi. http://developer.android.com/resources/dashboard/screens.html - here you can see what sizes and densities are the most popular. However, you can create layout specially for resolution you need (i.e. several layout for hdpi devices with different resolutions). The most popular resolutions are 320x480, 800x480, 854x480 (often I use the same layout as for 800x480).
You can read about supporting multiple screens here: http://developer.android.com/guide/practices/screens_support.html
不,我认为这并不重要,但是可能会有一些分辨率变化,例如像素部分。我认为最好的方法是,如果您为布局和可绘制对象制作一个以土地为后缀的地图,例如:layout-land
希望它有帮助!
No it doesn't matter I think, but can be there some resolution changes, like pixeled parts. I think that the best way to do it, if you make a land suffixed map for your layouts and drawables like: layout-land
Hope it helps!