TextView文本框,用于显示文本的一个控件
autoLink属性是用来识别链接类型的。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
tools:context=".MainActivity"
android:orientation="vertical">
<TextView
android:id="@+id/tv"
android:layout_width="300dp"
android:layout_height="100dp"
android:text="https://blog.csdn.net/SeNiLS"
android:gravity="center"
android:background="@color/purple_200"
android:textSize="20sp"
android:textStyle="italic"
android:textColor="@color/black"
android:autoLink="web"/>
</LinearLayout>
shape的基本属性
corners(圆角):用来定义圆角
solid(填充色):用来指定内部填充色
gradient(渐变):用以定义渐变色,可以定义两色渐变和三色渐变,及渐变样式
stroke(描边):可以定义描边的宽度、颜色、虚实线等
padding(内边距):用来定义内部边距
size(大小):用来定义图形的大小的
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:radius="10dp"
android:topLeftRadius="5dp"
android:topRightRadius="5dp"
android:bottomLeftRadius="5dp"
android:bottomRightRadius="5dp"/>
<solid android:color="#ffff00"/>
<gradient
android:type="linear"
android:angle="90"
android:centerX="0.5"
android:centerY="0.5"
android:startColor="#24e9f2"
android:centerColor="#2564ef"
android:endColor="#25f1ef"
android:gradientRadius="5dp"
android:useLevel="false"/>
<stroke
android:width="1dp"
android:color="#ff0000"
android:dashWidth="1dp"
android:dashGap="1dp"/>
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"/>
<size
android:width="50dp"
android:height="50dp"/>
</shape>