如何仅验证风景中的肖像 [英] how to validate only portrait from landscape

查看:52
本文介绍了如何仅验证风景中的肖像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



如果我从横向单击ctrl + F12,则将以下代码仅用于纵向模式,

Hi,

I have used following code to only portrait mode if i clicked ctrl+F12 from landscape,

<activity android:name=".TextBoxWindowActivity" xmlns:android="#unknown">
           android:screenOrientation="portrait"    >


但这不起作用,因此请举一个例子


but this is not working so please reply with an example

推荐答案

我的书带有XML的Android UI设计在亚马逊上使用的例子

如果希望仅在纵向模式下查看屏幕显示,则必须在AndroidManifest.xml中添加一个条目,指出该应用程序仅在纵向模式下运行.

Example used in my book Android UI design with XML on amazon

If you wish to see your screen display only in portrait mode, you must add an entry in AndroidManifest.xml saying that app runs only in portrait mode.

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
package="com.UInterface.book.gamelevel"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minsdkversion="8" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".GamelevelActivity">
android:label="@string/app_name"

android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>


在您的android清单文件中添加此行代码

android:screenOrientation =肖像"
Add this line of code in your android manifest file

android:screenOrientation="portrait"


这篇关于如何仅验证风景中的肖像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆