Menus

Monday 1 July 2019

Android Scrolling text in Textview


Android auto scrolling text

This tutorial explain to scroll text message on activity.

How to make Marquee text in Android?


Property as marquee
android:ellipsize = "marquee"
android:fadingEdge = "horizontal"
android:marqueeRepeatLimit = "marquee_forever"
android:scrollHorizontally = "true"
android:singleLine = "true"






Add the following code to res/layout/activity_main.xml.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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.example.root.scrolling.MainActivity">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            >



                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Hello World!" />

                <TextView
                    android:id="@+id/txtScroll"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:textSize="30dp"
                    android:background="#D0D0D0"
                    android:text="http://yii2ideas.blogspot.com/"

                    android:focusable="true"

                    android:focusableInTouchMode="true"
                    android:singleLine="true"
                    android:scrollHorizontally="true"
                    android:ellipsize="marquee"
                    android:marqueeRepeatLimit="marquee_forever"
                    />
             
        </LinearLayout>
     
</RelativeLayout>




Useful Links
Android Drop Down List Tutorial

Android date picker dialog



No comments:

Post a Comment