Create text in textView in horizontal scroll bar format using HorizontalScrollView example tutorial.
Creating textView with horizontally text format with horizontal scrollview is very easy with the use of HorizontalScrollView widget. So here is the complete step by step tutorial for Scroll textview text horizontally in android using ScrollView.
How to Scroll textview text horizontally in android using ScrollView.
Code for MainActivity.java file.
package com.horizontallyscrollviewtextview_android_examples.com; import android.app.Activity; import android.os.Bundle; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
Code for activity_main.xml layout file.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.horizontallyscrollviewtextview_android_examples.com.MainActivity" android:orientation="horizontal" > <HorizontalScrollView android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"> <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView horizontal text example tutorial" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_gravity="center" android:layout_marginTop="20dp" /> </LinearLayout> </HorizontalScrollView> </LinearLayout>
Screenshot: