RelativeLayout with scrollview not scrolling

别来无恙 提交于 2019-12-01 18:30:48

That is because you set the height of the ScrollView to wrap_content. Try giving it a fixed height or using a LinearLayout with weight so it fills the space left over from the other views.

If you do not want to set it to a specific height, you can also add

android:fillViewport="true"

to your ScrollView

cmcromance

Your scroll view doesn't have any problem. But, You can not see your scroll bar because your textview has too short text.

Update your code like below.

Scroll bar will be shown up when contents are long than yours automatically.

Good luck, Josh!

<ScrollView android:layout_height= " fill_parent "
    android:layout_toRightOf="@+id/q" android:layout_marginTop="10dp"
    android:layout_width="150dp">

    <TextView android:id="@+id/question"
        android:text="Test annswer a Test annswer a Test annswer a Test annswer a Test annswer a Test annswer a Test annswer a Test annswer a Test annswer a Test annswer a Test annswer a Test annswer a Test annswer a ....."
        android:layout_height="fill_parent"
        android:layout_toRightOf="@+id/q" android:layout_marginTop="10dp"
        android:layout_width="150dp" android:textColor="#000000"
        android:textSize="18sp" android:textStyle="bold" />
</ScrollView>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!