I\'m working on fixing a bug in someone\'s code and I can\'t figure out how to get this to scroll correctly. I\'m just trying to get the \"question\" area to scroll vertical
If you do not want to set it to a specific height, you can also add
android:fillViewport="true"
to your ScrollView
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>
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.