0

我正在尝试使用 relative 和 LinearLayout 进行滚动,但不起作用?我是为 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>

我正在尝试使用 relative 和 LinearLayout 进行滚动,但不起作用?我是为 android 开发的新手,缺少一些参数

4

6 回答 6

1

问题不清楚......但如果你需要滚动线性布局,你需要用scrollview包装它......这是你需要的吗?

于 2013-01-07T13:49:56.533 回答
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>
于 2013-01-07T13:53:26.477 回答
0

您需要在可滚动的内容周围添加一个 ScrollView。

于 2013-01-07T13:47:37.650 回答
0

你没有错过一个参数。您应该使用 ScrollView。

于 2013-01-07T13:47:48.680 回答
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>
于 2013-01-07T13:47:58.410 回答
0

只需将顶层布局设为 ScrollView 即可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>
于 2013-01-07T13:55:25.440 回答