2014-05-15 25 views

回答

0

試試這個代碼,滾動視圖是從按鈕到中途的一半,很多TextView是用於檢查滾動視圖的。

<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" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context=".MainActivity" > 

    <ScrollView 
     android:id="@+id/scrollView1" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentLeft="true" 
     android:layout_alignTop="@+id/button1" 
     android:layout_marginLeft="22dp" 
     android:layout_marginTop="20dp" > 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical" > 

      <TextView 
       android:id="@+id/textView1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Large TextLarge TextLarge TextLarge 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text 
       Large TextLarge TextLarge TextLarge TextLarge Text" 
       android:textAppearance="?android:attr/textAppearanceLarge" /> 
     </LinearLayout> 
    </ScrollView> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignLeft="@+id/scrollView1" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="39dp" 
     android:layout_marginRight="39dp" 
     android:background="#ffff55" 
     android:text="Button" /> 

</RelativeLayout> 
+0

這裏有一個問題,那裏的按鈕是可點擊的 – user1562058

+0

你可以在類中編寫button.setClickable(false); –

相關問題