2013-02-20 118 views
0

檢查出這個代碼按鈕覆蓋滾動型

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" > 

<ScrollView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:fadeScrollbars="true" 
    android:scrollbarStyle="insideInset" > 

    <TextView 
     android:id="@+id/txt" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:autoLink="all" 
     android:paddingLeft="3dp" 
     android:paddingRight="3dp" 
     android:textIsSelectable="true" /> 
</ScrollView> 

<Button 
    android:id="@+id/nextbtn" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:onClick="nextButton" 
    android:text="@string/next" /> 

<Button 
    android:id="@+id/backbtn" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:onClick="prevButton" 
    android:text="@string/back" /> 

我得到的結果是,儘管滾動視圖和文本顯示,在底部的按鈕,左邊和左下角都在頂部文字/滾動視圖。我曾嘗試使用linearlayout,但沒有運氣。請幫助。

+0

給你的滾動視圖一個ID,並嘗試添加到您的按鈕:'android:layout_below =「@ + id/scrollViewId」' – 2013-02-20 20:33:21

+0

嘗試賈斯汀V的回答@mister_dani – Shoshi 2013-02-20 20:48:03

回答

1

嘗試通過你的滾動型增加android:layout_above="@+id/nextbtn"如下:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" > 

    <ScrollView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:fadeScrollbars="true" 
     android:scrollbarStyle="insideInset" 
     android:layout_above="@+id/nextbtn" > 

     <TextView 
      android:id="@+id/txt" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:autoLink="all" 
      android:paddingLeft="3dp" 
      android:paddingRight="3dp" 
      android:textIsSelectable="true" /> 
    </ScrollView> 

    <Button 
     android:id="@id/nextbtn" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:onClick="nextButton" 
     android:text="next" /> 

    <Button 
     android:id="@+id/backbtn" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:onClick="prevButton" 
     android:text="back" /> 

</RelativeLayout> 

編輯:不幸的是,因爲Android的填充屏幕上用滾動型和賈斯汀五答案不工作把你下面的按鈕,出來的屏幕。

+0

謝謝,亞歷克斯河你如何處理按鈕:「id/backbtn」too – 2013-02-21 07:28:03

+0

非常感謝alex,完美工作 – 2013-02-21 08:25:46

+0

不客氣:) – 2013-02-21 08:31:15