繁体   English   中英

Android Rotation隐藏一些小部件

[英]Android Rotation Hide some Widgets

这是我的活动的xml文件。 除非旋转,否则效果很好。 在我的手机中,如果启用了“自动旋转”,则屏幕也会旋转。 在旋转过程中,它不会显示名为“退出”的按钮。 我尝试滚动到底部,但无法滚动。

   <?xml version="1.0" encoding="utf-8"?>
<ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scrollbars="none" >

<AbsoluteLayout 
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout 
    android:id="@+id/ll_buttons"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical|center_horizontal"
    android:layout_below="@+id/slogon"      
    android:layout_marginTop="50dip">
    <ImageView
        android:id="@+id/image1"
        android:layout_width="match_parent"
        android:layout_height="481dp"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:background="@drawable/ic_launcher" />
</LinearLayout>
<Button android:layout_height="wrap_content" android:textColor="#FF0000"     android:textStyle="bold" android:id="@+id/button2" android:layout_width="wrap_content" android:text="EXISTINGFARMER" android:layout_x="161dip" android:layout_y="157dip"></Button>
<Button android:layout_height="wrap_content" android:textColor="#FF0000" android:textStyle="bold" android:id="@+id/button1" android:layout_width="wrap_content" android:text="NEW FARMER" android:layout_x="34dip" android:layout_y="157dip"></Button>
<Button android:layout_height="wrap_content" android:textColor="#FF0000" android:textStyle="bold" android:id="@+id/btn_exit" android:layout_width="100dip" android:text="EXIT" android:layout_x="105dip" android:layout_y="233dip"></Button>
<TextView android:layout_height="wrap_content" android:textStyle="bold" android:textSize="40dip" android:layout_width="wrap_content" android:textColor="#FFEA00" android:id="@+id/heading" android:text="S.V.Sugar Mills" android:layout_x="29dip" android:layout_y="14dip"></TextView>

<TextView
    android:id="@+id/subheading"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_x="38dp"
    android:layout_y="97dp"
    android:text="The New and Old Farmer Details."
    android:textColor="#0000A0"
    android:textSize="15dip"
    android:textStyle="bold" />

</AbsoluteLayout>
</ScrollView>

我不了解该错误,我知道旋转过程中如何滚动,请帮助我。 提前致谢

首先,如果要支持纵向或横向模式下的滚动,则必须将所有小部件置于scrollview中。

请使用scrollview。 Scrollview仅支持一个直接子级。 因此,您需要将相对布局或线性布局作为scrollview的子级,将所有小部件控件置于该子级中。

在这里查看scrollview教程。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM