手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >android开发教程之自定义控件checkbox的样式示例
android开发教程之自定义控件checkbox的样式示例
摘要:主界面xml文件复制代码代码如下:/res/drawable-hdpi/check_selector.xml复制代码代码如下:P.S:重点:...

主界面xml文件

复制代码 代码如下:

<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" >

<CheckBox

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:button="@drawable/check_selector"

android:checked="true" />

</RelativeLayout>

/res/drawable-hdpi/check_selector.xml

复制代码 代码如下:

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/checkok" android:state_checked="true"></item>

<item android:drawable="@drawable/checkno" android:state_checked="false"></item>

</selector>

P.S:重点: android:button="@drawable/check_selector"

check_selector.xml中的checkok为CheckBox选中状态的图片,checkno为CheckBox未选中状态的图片.

【android开发教程之自定义控件checkbox的样式示例】相关文章:

Android用户界面开发之:TextView的使用实例

android dialog自定义实例详解

Android应用开发UI控件ImageSwitcher的使用

Android开发笔记之:如何安全中止一个自定义线程Thread的方法

安卓开发教程之判断出屏的方法

android 自定义Android菜单背景的代码

android 开发教程之日历项目实践(一)

在android开发中进行数据存储与访问的多种方式介绍

Android开发之相对布局

Android编程设置全屏的方法实例

精品推荐
分类导航