有没有详细讲解安卓XML的书
照书做了一段时间的例子,刚适应了各种 Layout 中嵌套各种控件(Button TextView)。
今天继续做例子,发现XML中除了控件以外还有其他“关键字”,比如下面的“selector” 和 “item”,这是什么意思,哪里来的

绿色按钮按下的时候变成红色,松开的时候恢复绿色
今天继续做例子,发现XML中除了控件以外还有其他“关键字”,比如下面的“selector” 和 “item”,这是什么意思,哪里来的
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/root"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="文字带阴影的按钮"
android:textSize="12pt"
android:shadowColor="#aa5"
android:shadowRadius="1"
android:shadowDx="5"
android:shadowDy="5" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="普通按钮"
android:id="@+id/button"
android:background="@drawable/red"
android:textSize="10pt" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="带文字的图片按钮"
android:id="@+id/button2"
android:background="@drawable/button_selector"
android:textSize="11px" />
</LinearLayout>
<?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>
绿色按钮按下的时候变成红色,松开的时候恢复绿色
...全文
相关推荐
《Android蓝牙BLE的详细讲解》 PDF
《Android蓝牙BLE的详细讲解》
【android开发-24】android中访问http协议网络以及解析xml格式数据的详细讲解
android中httpURLconnection,OKhttp访问网络用法,以及Pull和SAX解析xml格式数据的代码例子
安卓开发入门书源码下载
安卓开发入门的一本好书,适合初学者从零起步,一点点的打基础用,高手整合,这个包为该书配套源码。
安卓实例讲解及源码
安卓实例讲解及源码,很实用,深入浅出。包含一个BMI源文件。
安卓Android源码——xml-dom201311060201.zip
安卓Android源码——xml-dom201311060201.zip


