2013-03-02 31 views
0

这是我的一个活动的xml文件。除了轮换的情况外,它运作良好。在我的手机中,如果AutoRotation已启用,则屏幕也会旋转。在旋转期间,它不显示名为“退出”的按钮。我试过滚动到底部,但我无法滚动。Android旋转隐藏一些小工具

<?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> 

我不明白这个错误,我有人知道如何在旋转过程中滚动,请帮助帮助我。在此先感谢

回答

0

首先,如果您要支持纵向或横向模式的滚动,则必须将所有小部件放在滚动视图中。

请使用scrollview。 ScrollView只支持一个直接的孩子。因此,您需要将相对布局或线性布局作为scrollview的子项,将所有小部件控件放在该子布局中。

Look here for scrollview tutorial。

+0

你可以使用这段代码更新scrollview吗? – 2013-03-02 06:56:13

+0

@ ling.s我更新了我的答案。我为scrollview示例提供了一个链接。从那里你可以更好地了解如何使用滚动视图。 – 2013-03-02 06:58:39

+0

我可以在绝对布局中使用滚动视图吗? – 2013-03-02 06:59:15