如何使应用程序适合Android中的纵向、横向等配置?
我已经以纵向配置完成了我的应用程序。当我在设备中加载应用程序时,它会出现肖像配置。但在横向模式下我总是缺少一些控件。如何修复两种配置的屏幕?
I have done my application in portrait configuration. When I load my application in device its coming portraint configuration. But in landscape mode i keep missing some controls. How can I fix the screen for both configurations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个问题之前被问过:这里
如果您是初学者,您可能会发现以下内容很有用(阅读):
开发方向感知的 Android 应用
This question was asked before: here
If you are a beginner, you might find the following useful(read up):
Developing orientation aware Android apps
您可能必须为横向和纵向定义不同的布局。您可以强制 android 根据方向选择正确的布局。您可以将横向布局 xml 文件放在“res\layout-land”中,将纵向布局 xml 文件放在“res\layout”中。
当然,使用RelativeLayout 总是个好主意,但这取决于您的应用程序。
问候!
You probably have to define different layouts for landscape and portrait. You could force android to choose the proper layout depending on orientation. You could put landscape layout xml files in “res\layout-land” and portrait in “res\layout”.
Of course it’s always good idea to use RelativeLayout, but it depends on your application.
Regards!
看看这个。 Google 最近发布了有关此问题的教程: https://developer.android.com /resources/samples/MultiResolution/index.html
Check this out. Google has released a tutorial about this recently: https://developer.android.com/resources/samples/MultiResolution/index.html