我试图让我的文本视图在一个无限的way.But中从左到右运行,不知怎么的,它看起来真的很奇怪,我甚至无法用文字来解释它,所以我决定记录并上传它。
这是视频:https://www.youtube.com/watch?v=gj3FF7fEutk&feature=youtu.be
所以我就是这么写我的Textview的:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit ="marquee_forever"
android:focusable="true"
android:focusableInTouchMode="true"
android:scrollHorizontally="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Title"
android:layout_marginTop="20dp"
android:textColor="@color/white"
android:id="@+id/textView_title_full"
android:layout_centerHorizontal="true" />这个TextView在一个RelativeLayout中,声明如下:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="170dp"
android:id="@+id/BELOW_FULL"
android:layout_gravity="bottom"
android:background="@drawable/color_below_player_full"
android:layout_below="@+id/viewpager_albumart_full"
android:layout_alignParentBottom="true">其中,RelativeLayout也处于如下的Relativelayout中:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1"
android:background="#0E0E0E">我当然使用了txt_song_title.setSelected(true);方法。
我想要实现的目标是什么:https://www.youtube.com/watch?v=o4uAA4pik68
非常感谢大家!
编辑:
我用我的TextView做某事的所有部分:
public void init_textviews()
{
...
txt_song_title = (TextView)findViewById(R.id.textView_title_full);
txt_song_title.setSelected(true);
} //init_textviews()在我的onCreate方法中被调用
txt_song_title.setText("Some Long text"); // called in onCreate after init_textviews()最后:
public static void update_GUI_full (Context context) //Called when it is a button is clicked
{
...
txt_song_title.setText("longTexthere");
...
}发布于 2016-03-26 15:32:29
与@Ahmet Kazaman并排工作,我们发现,当将块TextView与使用Handler定期更新的另一个TextView合并时,似乎存在问题。
经过一些测试后,我们发现这种奇怪的行为只有在TextViews是RelativeLayout时才会发生,当封装的布局是LinearLayout时,一切都会如期而至。因此,解决方案(更多的解决办法)是将封装的布局更改为Linearlayout。
https://stackoverflow.com/questions/36179278
复制相似问题