2013-01-07 63 views
0

我想用相對和LinearLayout進行滾動,但不起作用?我是新來的發展android'm缺少一些參數不滾動android?

<LinearLayout 
    android:id="@+id/contentSobre" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <RelativeLayout 
     android:id="@+id/imageContent" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 

     <ImageView 
      android:id="@+id/structImageOne" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentTop="true" 
      android:src="@drawable/exemple_sobre" /> 

     <ImageView 
      android:id="@+id/structImageTwo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:src="@drawable/exemple_sobre" /> 
    </RelativeLayout> 

    <TextView 
     android:id="@+id/titleSobre" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dp" 
     android:textSize="20sp" 
     android:textColor="#53390e" 
     android:text="SANTO GRÃO - OSCAR FREIRE" /> 


    <TextView 
     android:id="@+id/numberContact" 
     android:layout_marginTop="3dp" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="10sp" 
     android:textColor="#565656" 
     android:text="TELEFONE(s): (11) 3082-9969" /> 

    <TextView 
      android:id="@+id/descriptionSobre" 
      android:textSize="13sp" 
      android:textColor="#4a4a4a" 
      android:layout_marginTop="10dp" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:maxLines="200" 
      android:singleLine="false"    
      android:text="it does not ghave any brea this is a very long text. so long that it does not it does not ghave any brea this is a very long text. so long that it does not it does not ghave any brea this is a very long text. so long that it does not it does not ghave any brea this is a very long text. so long that it does not it does not ghave any brea this is a very long text. so long that it does not it does not ghave any brea this is a very long text. so long that it does not ghave any brea this is a very long text. so long that it does not ghave any brea this is a very long text. so long that it does not ghave any brea this is a very long text. so long that it does not ghave any brea this is a very long text. so long that it does not ghave any brea this is a very long text. so long that it does not ghave any brea this is a very long text. so long that it does not ghave any brea this is a very long text. so long that it does not ghave any brea" /> 

    <RelativeLayout 
     android:id="@+id/buttonContent" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dp" > 


     <ImageButton 
      android:id="@+id/buttonCall" 
      android:layout_width="97dp" 
      android:layout_height="30dp" 
      android:scaleType="fitEnd" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentTop="true" 
      android:background="@android:color/transparent" 
      android:src="@drawable/button_call_sobre" />   

     <ImageButton 
      android:id="@+id/buttonMaps" 
      android:layout_width="97dp" 
      android:layout_height="30dp" 
      android:scaleType="fitEnd" 
      android:layout_marginLeft="10dp" 
      android:background="@android:color/transparent" 
      android:layout_toRightOf="@+id/buttonCall" 
      android:src="@drawable/button_maps_sobre" /> 

     <ImageButton 
      android:id="@+id/buttonTwitter" 
      android:layout_width="34dp" 
      android:layout_height="34dp" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:background="@android:color/transparent" 
      android:src="@drawable/button_twitter" 
      android:onClick="onTouchMenu" /> 

     <ImageButton 
      android:id="@+id/buttonFacebook" 
      android:layout_width="34dp" 
      android:layout_height="34dp" 
      android:layout_toLeftOf="@+id/buttonTwitter" 
      android:background="@android:color/transparent" 
      android:src="@drawable/button_facebook" 
      android:onClick="onTouchMenu" /> 

    </RelativeLayout> 
</LinearLayout> 

我試圖做一個滾動相對與LinearLayout中,但不起作用?我是新開發android'm缺少一些參數

回答

1

你應該使用ScrollView作爲Top Wrapper Layout.ScrollView只支持垂直滾動。對於水平滾動,請使用HorizontalScrollView

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
    <LinearLayout> 
     <RelativeLayout> 
     </RelativeLayout> 
     <RelativeLayout> 
     </RelativeLayout> 
    </LinearLayout> 

</ScrollView> 
0

你需要添加一個ScrollView的內容將被scrallable。

0

你是不是缺少一個參數。你應該使用ScrollView。

+0

如何在滾動時刪除藍條android – Nagi

+0

View.setVerticalScrollBarEnabled(false); – Gridtestmail

+0

是用xml – Nagi

0

將頂部佈局設置爲ScrollViewScrollView是一個視圖層次結構的佈局容器,可以由用戶滾動,允許它大於物理顯示。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 

    Your other layout goes here and remember it can take only one child 


</ScrollView> 
+0

確定..滾動android時如何去除藍條? – Nagi

+0

View.setVerticalScrollBarEnabled(false); – Gridtestmail

+0

是用xml做的嗎? – Nagi

1

問題不是很清楚......但是如果你需要滾動線性佈局,你需要用scrollview包裝它..你需要什麼?

0

只是要頂層佈局滾動型ScrollView是一個視圖層次結構的佈局容器,可以由用戶滾動,允許它大於物理顯示。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     > 

      <!-- Put everything you already have here --> 

    </ScrollView>