textscrollmarqueecrouton-os

Android Crouton custom view doesn't allow text scrolling(marquee effect)


I have been trying to achieve marque effect of text on android inside the notification library CROUTON. My function is under.

public void onCustomNotice(View v) {

    View customView = getLayoutInflater().inflate(R.layout.custom_crouton_layout, null);
    Crouton.show(this, customView);
}

and my custom layout is as under.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#c9dfff"
android:layout_gravity="center"
android:orientation="vertical"
android:paddingTop="15dp"
android:paddingBottom="15dp"
>

<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center" >
    <TextView
        android:id="@+id/scroller"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ellipsize="marquee"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:singleLine="true"
        android:marqueeRepeatLimit="marquee_forever"
        android:maxLines="1"
        android:text="Some veryyyyy long text with all the characters that cannot fit in screen, it so sad :( that I will not scroll"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</RelativeLayout>

</LinearLayout>

Usual textview works as marque but inside crouton it does not. Please suggest some solutions. Thank you in advance. :)

i referred this link but i did not get expected answer.


Solution

  • I would rather suggest you to use snackbar library which is pretty much flexible. Take a look at this

    www.github.com/nispok/snackbar

    There are lot many other animations too.