<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.toby.personal.datatypeconverttest.MainActivity"
android:orientation="vertical">
<!--设置字号为20pt,文本框结尾处绘制图片-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/test"
android:textSize="20pt"
android:drawableEnd="@mipmap/ic_launcher" />
<!--设置中间省略,所有字母大写-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="@string/ellipsize"
android:ellipsize="middle"
android:textAllCaps="true" />
<!--对邮件、电话增加链接-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="my email: my_mail@mail.com, my phone: 0108888888"
android:autoLink="email|phone" />
<!--设置文字颜色、大小,使用阴影-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/test"
android:shadowColor="@color/colorAccent"
android:shadowDx="10.0"
android:shadowDy="8.0"
android:shadowRadius="3.0"
android:textColor="@color/colorPrimary"
android:textSize="18pt" />
<!--可勾选的文本-->
<CheckedTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/checkedText"
android:checkMark="@mipmap/ic_launcher"/>
</LinearLayout>
TextView 的一些常用的设置
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 【蝴蝶效应】 蝴蝶效应:上个世纪70年代,美国一个名叫洛伦兹的气象学家在解释空气系统理论时说,亚马逊雨林一只蝴蝶...