如何设置android显示垂直方向? [英] How to set android show vertical orientation?
本文介绍了如何设置android显示垂直方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从以下 .xml 文件中,我将 xml 设置为显示 TabHost,但在模拟器上运行它后,它同时显示两个方向.我想将其设置为仅显示一个方向.我该怎么办?谢谢.
From following .xml file I set xml to show TabHost but after i run it on emulator it show both both orientation. i want to set it to show only one orientation. How do i do? THanks you.
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_above="@android:id/tabs" />
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</TabHost>
推荐答案
在 manifest.xml 文件中添加这一行.
add this line in your manifest.xml file.
<activity android:name=".activity"
android:screenOrientation="portrait">
</activity>
如果您只想要横向,则更改为 landscape
而不是 portrait
if you want only landscape orientation then change to landscape
instead of portrait
这篇关于如何设置android显示垂直方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文