您的位置:首页 > 移动开发 > Android开发

Android之TextView效果

2016-05-25 17:53 369 查看
跑马灯效果(文字要足够长):

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="true"
android:focusableInTouchMode="true"/>


自动链接(电话.Email.网址都可以支持自动转换成链接):

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:autoLink="all"
android:text="@string/name"/>


文本删除线

textView.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);

备注:TextView的Text可加载自HTML文件或HTML字符串

TextView t3 = (TextView) findViewById(R.id.text3);
t3.setText(
Html.fromHtml(
"<b>text3:</b>  Text with a " +
"<a href=\"http://www.google.com\">link</a> " +
"created in the Java source code using HTML."));
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: