2013-03-02 34 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