Android 从右向左转换文本视图

Android 从右向左转换文本视图,android,textview,translate-animation,Android,Textview,Translate Animation,在操作栏中有一个文本视图。我翻译文本视图,但是文本太长,被剪切或有点。 我该怎么办?谢谢 这是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

在操作栏中有一个文本视图。我翻译文本视图,但是文本太长,被剪切或有点。 我该怎么办?谢谢

这是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);

LayoutFlater充气机=LayoutFlater.from(本机);
查看自定义=充气机。充气(R.layout.layout\u custom\u actionbar,null);
TextView currentTeam=(TextView)custom.findViewById(R.id.current\u team\u actionbar);
currentTeam.setText(“文本”);
actionBarTabsMenu.setCustomView(自定义);
actionBarTabsMenu.setDisplayShowCustomEnabled(true);

您可能想要的是滚动文本,使其全部可见:

<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"/>


设置较小的文本大小或使用ellipsize=“end”使文本不会被剪切。翻译动画xml/code在哪里?使用ellipsize=“end”有3个点,这是预期的结果。你能做的事情不多了。文本与您的屏幕大小重叠。除非您希望标题包含多个字符lines@Deca我忘了您需要添加
focusable
android:focusableInTouchMode
属性,请参阅更新的答案。