【问题标题】:Android Crouton custom view doesn't allow text scrolling(marquee effect)Android Crouton 自定义视图不允许文本滚动(选框效果)
【发布时间】:2015-11-30 10:43:00
【问题描述】:

我一直在尝试在通知库CROUTON中实现android上文本的标记效果。我的功能下。

public void onCustomNotice(View v) {

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

我的自定义布局如下。

<?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>

通常的 textview 可以作为 marque 使用,但在 crouton 内部却不行。请提出一些解决方案。先感谢您。 :)

我参考了this 链接,但我没有得到预期的答案。

【问题讨论】:

    标签: text scroll marquee crouton-os


    【解决方案1】:

    我宁愿建议你使用非常灵活的snackbar 库。看看这个

    www.github.com/nispok/snackbar

    还有很多其他的动画。

    【讨论】:

    • 正是我想要的...... :)
    猜你喜欢
    • 1970-01-01
    • 2023-03-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多