滚动条不起作用?
问题描述:
<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>
如果我在LinearLayout
中添加android:layout_gravity="bottom"
,则ScrollView
无法工作。 当我一直把视图放在LinearLayout
的时候,视图会自下而上地出现,这是我想要的。虽然结果是ScrollView
无法正常工作,但放在第一位的视图无法看到。如何解决?滚动条不起作用?
答
试试这个..
<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>
的xmlns:安卓= “http://schemas.android.com/apk/res/android” 不需要与LinearLayout中。 – himanshu
好的himanshu感谢您纠正我 – Shruti
它适用于从LinearLayout到ScrollView的android:layout_gravity =“bottom”。 – user898366