<?xml version="1.0" encoding="utf-8"?>
這是一個xml文檔,第一行是xml的文檔聲明,version="1.0"表示用xml1.0版本進行解析,文檔的字符編碼格式為utf-8。
學習XML的相關知識:
http://www.cnblogs.com/xdp-gacl/p/3928289.html
xmlns:android="http://schemas.android.com/apk/res/android"
聲明xml命名空間。xmlns意思為“xml namespace”.冒號后面是給這個引用起的別名。
schemas是xml文檔的兩種約束文件其中的一種,規(guī)定了xml中有哪些元素(標簽)、元素有哪些屬性及各元素的關系,當然從面向對象的角度理解schemas文件可以認為它是被約束的xml文檔的“類”或稱為“模板”。
match_parent與fill_parent
FILL_PARENT (renamed MATCH_PARENT in API Level 8 and higher), which means that the view wants to be as big as its parent (minus padding)
pi=4*Math.atan(1);為什么會等于pi
原因:調(diào)用Math模塊的atan函數(shù)。傳入1為參數(shù)。此函數(shù)為反正切函數(shù),π/4的正切是1。Math.atan(1)=π/4
所以4*(π/4)=π
答案引用至:http://math.stackexchange.com/questions/1211722/how-does-atan1-4-equal-pi
Android中foreach怎么寫?
一般寫法:
for(inti=0;i<10;i++){
btn[i].setOnClickListener(actionPerformed);
}
foreach寫法。
for(Buttoni:btn){
i.setOnClickListener(actionPerformed);
}