Why my scrollHorizontally doesn't work?
android, scroll
Solution
To scroll horizontally you can place the TextView inside a HorizontalScrollView:
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
tools:context=".MainActivity" >
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/instruction_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollHorizontally="true"
android:text="@string/Texto_de_abertura"
android:textColor="#00FF00" />
</HorizontalScrollView>
<TableRow></TableRow>
</TableLayout>
The Android documentation describes scrollHorizontally as "Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally)" meaning a HorizontalScrollView is required to make the view scroll alongside setting the property to allow it to scroll. https://developer.android.com/reference/android/widget/TextView.html#attr_android:scrollHorizontally
Problem
``` <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#000000" tools:context=".MainActivity" > <TextView android:id="@+id/instruction_text" android:layout_width="match_parent" android:layout_height="wrap_content" android:scrollHorizontally="true" android:text="@string/Texto_de_abertura" android:textColor="#00FF00" /> <TableRow>code<TableRow> </TableLayout> ``` This is the code I'm using. The string Texto_de_abertura is really big, and it keeps using a lot of lines to put the entire string on the screen, not only one with scroll horizontally on as I wanted.