如何设置机器人表演垂直方向?机器人、如何设置、方向

2023-09-12 10:06:08 作者:じ浮年留下了那寂静的伤

从以下.xml文件,我将XML显示TabHost,但我在模拟器中运行它之后它同时显示两个方向。我想将它设置为只显示一个方向。我该怎么办?感谢你。

 < TabHost的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:ID =@机器人:ID / tabhost
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:方向=垂直>

    < RelativeLayout的
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =FILL_PARENT
        机器人:方向=垂直>

        <的FrameLayout机器人:ID =@机器人:ID / tabcontent
             机器人:layout_width =FILL_PARENT
             机器人:layout_height =FILL_PARENT
             机器人:layout_alignParentTop =真
             机器人:layout_above =@机器人:ID /标签/>
    < TabWidget机器人:ID =@机器人:ID /标签
             机器人:layout_width =FILL_PARENT
             机器人:layout_height =WRAP_CONTENT
             机器人:layout_alignParentBottom =真/>
    < / RelativeLayout的>
< / TabHost>
 

解决方案

在manifest.xml文件中加入这一行。

 <活动机器人:名称=活动
  机器人:screenOrientation =画像>
< /活性GT;
 

如果你只想横向然后更改为风景而不是人像

机器人图片 人类的伟大发明机器人的图片素材大全

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>

解决方案

add this line in your manifest.xml file.

<activity android:name=".activity"
  android:screenOrientation="portrait">
</activity>

if you want only landscape orientation then change to landscape instead of portrait