TextView功能总结(4)
来源:互联网 发布:手机淘宝怎么扫码 编辑:程序博客网 时间:2024/04/29 22:14
实例4:用TextView实现跑马灯效果
Activity编辑
public class MainActivity extends Activity {
private TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView=(TextView)this.findViewById(R.id.textview);
//给第二个“习近平”插入百度链接
String html="党媒盘点习近平执政三大建树:铁腕反腐赢得民心<a href='http://www.baidu.com'>习近平</a>";
CharSequence charSequence=Html.fromHtml(html);
textView.setMovementMethod(LinkMovementMethod.getInstance());
textView.setText(charSequence);
}
}
布局编辑
<TextView
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#ffffff"
//移动方式——跑马灯
android:ellipsize="marquee"
//聚焦
android:focusable="true"
//重复限制——无限
android:marqueeRepeatLimit="marquee_forever"
android:padding="10dp"
//显示方式——单行
android:singleLine="true"
android:textColor="#000"
android:textSize="20dp"
//链接可点击
android:linksClickable="true"
//通过touch获得focus
android:focusableInTouchMode="true">
</TextView>
- TextView功能总结(4)
- TextView功能总结(1)
- TextView功能总结(2)
- TextView功能总结(3)
- TextView总结
- android textView常用功能
- TextView常用功能
- Android TextView 复制功能
- textView 属性总结
- TextView 文字样式总结
- android textview问题总结
- textView 属性总结
- TextView 样式总结
- textView 属性总结
- 【总结】TextView的使用
- TextView学习总结
- textview的属性总结
- TextView 控件的总结
- Tomcat启动找不到StrutsPrepareAndExecuteFilter
- if语句和FOR语句 BAT
- android开发:android获取IMEI、MSISDN、ICCID、IMSI
- 聚类算法学习笔记(1)
- 最好玩的休闲捕鱼游戏:“全球捕鱼”
- TextView功能总结(4)
- 多视图传参数(简单传值,全局变量)
- cocos2d-x触摸事件处理的javascript开发出现getTouchDispatcher is not a function
- 机房收费系统之组合查询
- Android--JSON使用
- 自定义 Preference
- 云上的云:AVOS Cloud在云平台上构建云服务的经验分享
- linux c++下信号处理
- 黑马程序员-1.5新特性 自动拆箱装箱