Android TextView 跑马灯效果 - 2018年6月19日

第一步在布局中添加加粗部分代码:

<TextView
                android:id="@+id/tv_company"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:ellipsize="marquee"
                android:marqueeRepeatLimit="marquee_forever"
                android:singleLine="true"
                android:textColor="@color/black_alpha80"
                android:text="蓝蓝的天上白云飘,白云下面马儿跑,挥动鞭儿响四方,百鸟儿齐飞翔" />

第二步在代码中:

tvCompany.setText(applyBean.getCompany());
tvCompany.setSelected(true); //注意这一项,没有的话是不生效的

Bingo!

原文地址:https://www.cnblogs.com/jooy/p/9197242.html

时间: 2024-07-29 21:07:00

Android TextView 跑马灯效果 - 2018年6月19日的相关文章

Android TextView跑马灯效果

TextView跑马灯简单效果 <!--简单示例--> <TextView android:text="@string/longWord" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textView1" android:ellipsize="marquee&quo

Android TextView 跑马灯效果

文本跑马灯必须设置的几个文本属性: android:marqueeRepeatLimit="marquee_forever"     设置跑马灯的次数:永久            android:ellipsize="marquee" 跑马灯方式             android:focusable="true" 获取焦点            android:singleLine="true" 单行          

android在Gridview实现Textview跑马灯效果

默认是下面的属性添加TextView中: android:ellipsize="marquee" android:focusableInTouchMode="true" android:gravity="center" android:marqueeRepeatLimit="marquee_forever" android:scrollHorizontally="true" android:singleLi

Android TextView跑马灯

1 <TextView 2 android:layout_width="fill_parent" 3 android:layout_height="wrap_content" 4 android:layout_margin="20dp" 5 android:ellipsize="marquee" 6 android:focusable="true" 7 android:focusableInTouch

Android textview 跑马灯 要加的属性

<TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textColor="@android:color/white"  android:ellipsize="marquee"  android:focusable="true" android:singleLine = &q

android实现跑马灯效果

第一步:新建一个新项目,MarqueeTextView 首先为了观察到跑马灯效果,将要显示的文字极可能 写长.在strings.xml文件夹里面将 <string name="hello_world">hello_world</string> 修改为 <string name="hello_world">我的代码很长,真的很长,不行你看看,实际上是骗你的,逗比,hiahia~~~~</string> 默认情况下,显示文

android textview 跑马灯

<TextView android:layout_width="match_parent" android:layout_height="48dp" android:ellipsize="marquee" android:focusable="true" android:singleLine="true" android:textColor="#912CEE" android:te

Android中跑马灯效果

<com.randy.test1.self.MarqueeText android:id="@+id/btn1" android:layout_width="match_parent" android:layout_height="wrap_content" android:ellipsize="marquee" android:focusable="true" android:focusableIn

TextView跑马灯效果

<TextView android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1.0" android:ellipsize="marquee" android:focusable="true" android:focusableInTouchMode="true" a