如果放入更多元素,scrollview不会滚动

时间:2013-11-20 21:26:07

标签: android layout scrollview

为什么这个scrollview不起作用?我有两个textview布局,并没有工作,直到我把另一个textview。它似乎是元素的scrollview地图大小,而不是内容大小。

这是我的布局(xml):

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fillViewport="true"
        android:scrollbars="none">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

                <TextView
                    android:text="Lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet."
                    android:id="@+id/mainactivity_maintab_aria_bubble"
                    android:drawableTop="@drawable/icon_mainactivity_about"
                    android:background="@drawable/mainactivitiy_bubble_aria_background"
                    android:textColor="#EBEBEB"
                    style="@style/flat_chat_bubble"/>

                <TextView
                    android:text="Lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet."
                    android:id="@+id/mainactivity_maintab_user_bubble"
                    android:drawableTop="@drawable/icon_mainactivity_rate"
                    android:background="@drawable/mainactivitiy_bubble_user_background"
                    android:textColor="#EBEBEB"
                    android:layout_below="@+id/mainactivity_maintab_aria_bubble"
                    style="@style/flat_chat_bubble"/>
            </RelativeLayout>

    </ScrollView>

</LinearLayout>

1 个答案:

答案 0 :(得分:0)

替换:

     <?xml version="1.0" encoding="utf-8"?>

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



               <RelativeLayout
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content">

                      <TextView
                         android:text="Lorem ipsum dolor sit amet lorem ipsum dolor sit     amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet."
                         android:id="@+id/mainactivity_maintab_aria_bubble"
                         android:drawableTop="@drawable/icon_mainactivity_about"
                         android:textColor="#EBEBEB"
                         style="@style/flat_chat_bubble"/>

                            <TextView
                                android:text="Lorem ipsum dolor sit amet lorem ipsum  dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet."
                                android:id="@+id/mainactivity_maintab_user_bubble"
                                android:drawableTop="@drawable/icon_mainactivity_rate"
                             android:background="@drawable/mainactivitiy_bubble_user_background"
                               android:textColor="#EBEBEB"
                             android:layout_below="@+id/mainactivity_maintab_aria_bubble"
                               style="@style/flat_chat_bubble"/>
             </RelativeLayout>

       </ScrollView>