0

I have a widget which is containing a text view and this widget is included in my fragment layout file , I want to have the marquee effect for the textView inside the widget but it's not working. Here is what I have tried

widget_actions_button.xml

 <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
<TextView
                android:id="@+id/sub_title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ellipsize="marquee"
                android:focusable="true"
                android:maxLines="1"
                android:marqueeRepeatLimit="marquee_forever"
                android:singleLine="true"
                android:text="@{watch.subTitle}"
                android:textColor="@color/white_60_opaque"
                android:textSize="@dimen/text_size_xsmall"
                android:visibility="@{!TextUtils.isEmpty(watch.subTitle) ?View.VISIBLE:View.GONE,default=visible}"
                tools:text="Hello Kitty "
                tools:visibility="visible">
            </TextView>

</LinearLayout>

fragment.xml

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

                <com.x.uielements.widgets.ActionsWidget
                    android:id="@+id/actions"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="@dimen/dp16"
                    android:layout_marginTop="@dimen/dp24"
                    android:layout_marginEnd="@dimen/dp16"
                    android:visibility="@{viewmodel.showActionError == false? View.VISIBLE:View.GONE}"
                    tools:visibility="gone" />
</FrameLayout>

widget_actions.xml

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:bind="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

        <variable
            name="actionData"
            type="com.x.uielements.entity.ActionsItem" />
        <import type="android.view.View"/>
    </data>

    <LinearLayout
        tools:background="#2d280b"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

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

            <include
                android:id="@+id/watch"
                layout="@layout/widget_actions_button"
                bind:action="@{actionData.watch}"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/dp12" />
</LinearLayout>
</LinearLayout>
</layout>

Ignore the naming , code is working fine

I have also used isSelected = true for sub_title in widget_actions class through code

Anirudh
  • 1
  • 1

0 Answers0