@king
2015-04-08T03:32:29.000000Z
字数 1453
阅读 2534
Android
定义一个线程周期性地执行任务
new Timer().schedule(new TimerTask() {@Overridepublic void run() {...}}, 0, 200);
TextView 直接继承了 View, 还是EditText、Button的父类。
EditText允许用户编辑文本框中的内容
CheckedTextView 在文本右侧有个可勾选的方框
圆角边框、渐变背景的TextView:
布局文件:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="带边框的文本"android:textSize="24pt"android:background="@drawable/bg_border"/><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="圆角边框、渐变背景的文本"android:textSize="24pt"android:background="@drawable/bg_border2"/></LinearLayout>
两个drawable文件
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" ><!-- 透明背景 --><solid android:color="#0000"/><!-- 红色边框 --><stroke android:width="4px" android:color="#f00"/></shape>
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle"><!-- 指定圆角矩形的4个圆角的半径 --><cornersandroid:topLeftRadius="20px"android:topRightRadius="5px"android:bottomRightRadius="20px"android:bottomLeftRadius="5px"/><!-- 指定边框线条的宽度和颜色 --><strokeandroid:width="4px"android:color="#f0f"/><!-- 指定渐变背景色 --><gradientandroid:startColor="#f00"android:centerColor="#0f0"android:endColor="#00f"android:type="sweep"/></shape>