定义xml为drawable文件并根据状态改变显示的图片资源
在Button上触摸按下的时候,Button有focused,pressed和default状态,可以使用不同的图片来显示这三种状态。
先定义一个名为btnselector.xml文件,代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_focused="true"
android:state_pressed="false"
android:drawable="@drawable/focused"
></item>
<item
android:state_focused="true"
android:state_pressed="true"
android:drawable="@drawable/focusedpressed"
></item>
<item
android:state_focused="false"
android:state_pressed="true"
android:drawable="@drawable/pressed"
></item>
<item
android:drawable="@drawable/default"
></item>
</selector>
ImageButton使用btnselector.xml如下:
<ImageButton
android:id="@+id/stop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btnselector"
android:background="#00000000"
></ImageButton>
android:src赋值为"@drawable/btnselector",而不是指向具体的图片资源。
相关文档:
前提:1.Jdom的架构已经导入
步骤:
用JDOM读取XML文件需先用org.jdom.input.SAXBuilder对象的build()方法创建Document对象,
然后用Document类、Element类等的方法读取所需的内容。
<?xml version="1.0" encoding="UTF-8"?>
<HD>
<disk name="C">
<capacity>8 ......
xhtml的昙花一现带来不少问题,它的目的是让html表现得更像xml,所以才叫xhtml。但是出师未捷身先死,我们讨论一下如何判定文档是XML吧。
印象中jQuery对此方法重复实现了许多次,应该比较权威,也说明这判定比较难搞。看jQuery1.42的实现:
var isXML = function(elem){
// documentElement is verifi ......
在
SQLServer2005
中对
XML
的处理功能显然增强了很多,提供了
query(),value(),exist(),modify(),nodes()
等函数。
关于
xml
,难以理解的不是
SQLServer
提供的函数,而是对
xml
本身的理解,看似很简单的文件格式,处理起来却是非常困难的。本文只是初探一下而已。
详见
SQLServer
联机帮助:
主题
说 ......
对于将TXT文档中数据导入XML中的程序网上不多,但是有很多是先将TXT导入到DataSet中,在用XML进行传输。所以本人就在这里与大家分享一下直接导入的这种方式。
本程序也可以应用于ASP.NET中,那么下面的命名空间及一些地方就得改改了,还有要将程序都放于Page_Load中。
using System;
using System.Collections.Generic;
......