0

I'm trying to making a scroll with relative and LinearLayout but does not work? I am new to developing for android'm missing some parameter

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

I'm trying to making a scroll with relative and LinearLayout but does not work? I am new to developing for android'm missing some parameter

Nagi
  • 319
  • 1
  • 3
  • 11

5 Answers5

1

THe question isnt clear... but if you need to scroll the linear layout, you need to wrap it with scrollview.. is that what you need?

mcr619619
  • 435
  • 1
  • 4
  • 13
1

You should use a ScrollView as Top Wrapper Layout.ScrollView only supports vertical scrolling. For horizontal scrolling, use 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>
Vikalp Patel
  • 10,669
  • 6
  • 61
  • 96
0

You need to add a ScrollView aroud the content which will be scrallable.

Stephane Mathis
  • 6,542
  • 6
  • 43
  • 69
0

You are not missing a parameter. You should be using a ScrollView.

Lieuwe
  • 1,734
  • 2
  • 27
  • 41
0

Make the top Layout as ScrollView. The ScrollView is a Layout container for a view hierarchy that can be scrolled by the user, allowing it to be larger than the physical display.

<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>
K_Anas
  • 31,226
  • 9
  • 68
  • 81
Gridtestmail
  • 1,459
  • 9
  • 10