Reputation: 63
I want to scroll the results that view in a TextView, this my xml:
<scroll>
<TextView
android:id="@+id/ris"
android:layout_width="wrap_content"
android:layout_height="229dp"
android:layout_weight="0.96"
android:textAppearance="?android:attr/textAppearanceMedium" />
</scroll>
but the app crashes.
Upvotes: 2
Views: 1114
Reputation: 1
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="19dp"
android:layout_marginTop="24dp" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
tools:context=".Tester" />
</LinearLayout>
</ScrollView>
Upvotes: 0
Reputation: 83313
Add the following as attributes in your TextView
:
android:maxLines = "1"
android:scrollbars = "vertical"
Then once you have instantiated your TextView
, add the line:
mTextView.setMovementMethod(new ScrollingMovementMethod());
Upvotes: 1
Reputation: 603
add this in XML file for TextView
android:scrollHorizontally="true"
android:scrollVertically="true"
Upvotes: 1
Reputation: 15701
Use
<ScrollView> your View "</ScrollView">
And there must be only one child ScrollView.
Upvotes: 0