我可检测机器人既景观? [英] Can I detect both landscapes in android?
本文介绍了我可检测机器人既景观?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:结果
<一href=\"http://stackoverflow.com/questions/5088856/how-to-detect-landscape-left-normal-vs-landscape-right-reverse-with-support-f\">How检测横向向左(正常)与景观右(反向)与自然景观设备的支持?
是否可以旋转设备时,检测一个景观相较于其他景点?
Is it possible to detect one landscape vs the other landscape when rotating the device?
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE)
{
Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
}
else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT)
{
Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
}
}
的作品,但我想看看我是否能确定它是因为我想显示不同的布局,在手机的一侧。
works but I'd like to see if I can determine which side of the phone it is on as I want to display a different layout.
推荐答案
可以,运行Android 2.2以上版本的设备。请查看这个博客帖子为详细信息,或者您可以跳到点睛之笔。
You can, for devices running Android 2.2+. Check out this blog post for the details or you can skip to the punchline.
这篇关于我可检测机器人既景观?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文