Deca
Deca

Reputation: 153

Translate TextView from Right to Left

In the actionbar there is a textView. I translate the textview, but the text is too long and it is cut or there are dots. How can I do? Thanks

This is the xml:

<TextView 
    android:id="@+id/current_team_actionbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="text text text text text text text text text text 5"
    android:textColor="#ffff"
    android:maxLines='1'
    android:textSize="12sp"
    android:alpha="0.5" />

LayoutInflater inflater = LayoutInflater.from(this);
View custom = inflater.inflate(R.layout.layout_custom_actionbar, null);
TextView currentTeam = (TextView) custom.findViewById(R.id.current_team_actionbar);

currentTeam.setText("text text text text text text text text");
actionBarTabsMenu.setCustomView(custom);
actionBarTabsMenu.setDisplayShowCustomEnabled(true);

Upvotes: 1

Views: 1301

Answers (1)

Simas
Simas

Reputation: 44118

What you probably want is for the text to scroll so all of it is visible:

<TextView
    android:layout_marginLeft="20dp"
    android:layout_marginRight="20dp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:singleLine="true"
    android:ellipsize="marquee"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:focusable="true"
    android:focusableInTouchMode="true"/>

Upvotes: 1

Related Questions