滚动条不起作用?

时间:2011-11-18 09:54:27

标签: android xml layout

<ScrollView
    android:id="@+id/sv_chat"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@+id/layout_bottom"
    android:background="#ffffffff" >

    <LinearLayout
        android:id="@+id/layout_chatrecord"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_gravity="bottom"
        android:orientation="vertical" >
    </LinearLayout>
</ScrollView>

如果我在android:layout_gravity="bottom"中添加LinearLayout,则ScrollView无效。 当我一直在LinearLayout放置视图时,视图将从下到上显示我想要的结果。虽然结果是ScrollView无法工作,但首先看不到视图怎么解决呢?

1 个答案:

答案 0 :(得分:1)

试试这个..

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView01" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout 
        android:orientation="vertical" android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:scrollbars="vertical"
        android:scrollbarAlwaysDrawVerticalTrack="true">
</LinearLayout>
</ScrollView>
相关问题