button  And ImageButton
<!-- 普通文字按钮 --><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/red"android:text="普通按钮"android:textSize="10pt"/><!-- 普通图片按钮 --><pre name="code" class="html">

<ImageButtonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@drawable/blue"android:background="#000000"/>
  


<!-- 按下时显示不同图片的按钮 --><ImageButtonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@drawable/button_selector"android:background="#000000"/><!-- 带文字的图片按钮--><Buttonandroid:id="@+id/test"android:layout_width="wrap_content"android:layout_height="wrap_content"android:background="@drawable/button_selector"android:text="带文字的图片按钮"/>
button_selector.xml
<?xml version="1.0" encoding="UTF-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"><!-- 指定按钮按钮下时的图片 --><item android:state_pressed="true"android:drawable="@drawable/red"/><!-- 指定按钮松开时的图片 --><item android:state_pressed="false"android:drawable="@drawable/purple"/></selector>


单选框

<!-- 定义一组单选框 --><RadioGroup android:orientation="horizontal"android:layout_gravity="center_horizontal"><!-- 定义两个单选框 --><RadioButton android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="男"/><RadioButton android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="女"/></RadioGroup>

定义复选框


<!-- 定义三个复选框 --><CheckBox android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="红色"android:checked="true"/><CheckBox android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="蓝色"/><CheckBox android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="绿色"/>

TextView

<!-- 设置字体为20pt  --><TextViewandroid:layout_width="fill_parent" android:layout_height="wrap_content" android:text="我爱Java"android:textSize="20pt"/><!-- 设置中间省略 --><TextViewandroid:layout_width="fill_parent" android:layout_height="wrap_content"android:singleLine="true" android:text="我爱Java我爱Java我爱Java我爱Java我爱Java我aaaJava"android:ellipsize="middle"/><!-- 对邮件增加链接 --><TextViewandroid:layout_width="fill_parent" android:layout_height="wrap_content"android:singleLine="true" android:text="测试kongyeeku@163.com内容"android:autoLink="email"/><!-- 设置文字颜色 、大小,并使用阴影 --><TextViewandroid:layout_width="fill_parent" android:layout_height="wrap_content" android:text="测试文字"android:shadowColor="#0000ff"android:shadowDx="15.0"android:shadowDy="20.0"android:shadowRadius="45.0"android:textColor="#ff0000"android:textSize="25pt"/><!-- 测试密码框 --><TextView android:id="@+id/passwd"android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello"android:password="true"/>

时钟

<!-- 定义模拟时钟 --><AnalogClock  android:layout_width="wrap_content" android:layout_height="wrap_content" /><!-- 定义数字时钟 --><DigitalClockandroid:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="14pt"/>



更多相关文章

  1. Android(安卓)Studio代码笔记09.自定义视图
  2. android内部类
  3. Android在Button按钮上同时显示文字和图片
  4. 自定义Android(安卓)Toasts风格
  5. android 实用工具类-对话框
  6. android 文字滚动动画
  7. Android弹球小游戏
  8. android 笔记 --- 自定义Android主题风格theme.xml方法
  9. Android中的style&themes

随机推荐

  1. Fedora 15下使用android ndk 编译ffmepg0
  2. Android自定义标题栏
  3. Android(安卓)3.0 r1 API中文文档(106)
  4. Android(安卓)项目中集成 Flutter
  5. android 开发 时间选择器TimePicker的使
  6. Android开源项目第二篇——工具库篇
  7. Android(安卓)3.0动画学习笔记
  8. Android(安卓)使用CountDownTimer实现倒
  9. 为Android应用程序添加两个入口
  10. android安装后控件拖不动问题解答