定义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",而不是指向具体的图片资源。
相关文档:
由于现在在公司负责制作标准的静态页面,为了增强客户体验,所以经常要做些AJAX效果,也学你也和我一样在,学习AJAX。而设计AJAX时使用的一个重要的技术(工具)就是XMLHTTPRequest对象了。这里海啸把我学习XMLHTTPRequest对象的一点资料拿出来跟大家一起分享。文中的资料都是海啸在学习时在网上收集的,如果您开过,那就再 ......
XmlDocument doc = new XmlDocument();
string strtxt = "";
doc.Load(Server.MapPath("XMLFile1.xml"));
&nbs ......
一些字符在 URL 或 XML 文档中使用时有特殊的含义,因此必须针对这些含义对字符做适当编码以使其生效。
URL 中的特殊字符
在 URL 上执行的查询中,特殊字符被指定为 %xx,其中 xx 是字符的十六进制值。下表列出了这些特殊字符并描述了它们的含义。有关更多信息,请参见 http://www.faqs.org/rfcs/rfc1738.html 中的 RFC ......
<?php
include('xml.php');
$data = XML_unserialize($xml);
?>
$xml即是xml文件的内容,$data是解析出的数组;
<?php
include('xml.php');
$xml = XML_serialize($data);
?>
以上为使用实例,分别解析xml文档和生成xml格式的数据
xml.php源码
<?php
############################### ......