常用屬性
自定義邊框
基本使用
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle矩形/ring圓環/oval橢圓/line直線"當為圓環時android:shape="ring"android:useLevel="false"如果當作是LevelListDrawable使用時為true,否則為falseandroid:innerRadius="10dp"內環半徑android:innerRadiusRatio="2"浮點型,以環的寬度比來表示內環的半徑android:thicknessRatio="2"浮點型,以環的寬度比來表示環的厚度android:thickness="10dp"環的厚度
>
>
<corners角度android:topLeftRadius="10dp"左上角度android:topRightRadius="10dp"右上角度android:bottomLeftRadius="10dp"左下角度android:bottomRightRadius="10dp"/>右下角度<stroke描邊android:width="1dp"線寬度android:dashWidth="3dp"虛線寬度android:dashGap="3dp"虛線間距android:color="@color/purple_200"顏色/><padding android:bottom="5dp"內邊距android:top="5dp"android:left="5dp"android:right="50dp"/><gradient漸變填充android:angle="270"漸變角度,必須為45的倍數,0從左到右,90從上到下android:type="sweep掃描式漸變/radia放射漸變/linear線性漸變"android:startColor="@color/white"開始顏色android:centerColor="@color/grey"中間顏色android:endColor="@color/black"結束顏色android:centerX="0.6"漸變中心X的相當位置,0--1范圍android:centerY="0.1"漸變中心Y的相當位置,0--1范圍android:gradientRadius="5dp"漸變半徑,只有radia放射漸變使用/><size圖形大小android:width="100dp"寬度android:height="100dp"/>高度</shape>
詳細
文本框中的圖片使用
具體
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.jay.example.test.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawableTop="@drawable/show1"
android:drawableLeft="@drawable/show1"
android:drawableRight="@drawable/show1"
android:drawableBottom="@drawable/show1"
android:drawablePadding="10dp"
android:text="張全蛋" />
</RelativeLayout>