Header Ads

Header ADS

How to Marquee TextView(Continuous Scrolling Text) in Android Studio Kotlin

xml


 <LinearLayout

    android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/orange"
android:padding="5dp"
android:text="Notice"
android:textFontWeight="@integer/material_motion_duration_medium_2"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/marqueeTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Welcome to Boalkhali Upazila App. Hope you will get important information about Boalkhali."
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="true"
android:focusableInTouchMode="true"
android:scrollHorizontally="true"
android:padding="5dp"
android:textColor="@android:color/black"
android:textSize="16sp"/>

</LinearLayout>




MainActivity.kt

val marqueeTextView = findViewById<TextView>(R.id.marqueeTextView)
marqueeTextView.isSelected = true



No comments

Powered by Blogger.