第一個android項目開發日誌(1)

開發第一個android項目,現學現用,每天記點流水賬,把開發過程中遇到的點點滴滴記錄下來備忘。大部分都是網上搜索來的。

1.drawable目錄下不能建文件夾,不能用大寫命名文件名。

2.ImageButton的src可以設置成包含selector的drawable目錄下xml文件,selector的item要注意次序。且名字不能跟其他文件重名,因爲引用的時候不包括擴展名。

3.ImageButton設置背景屬性android:background="#00000000",可以顯示透明PNG圖片。
4.RelativeLayout佈局 
android:layout_marginTop="25dip" //頂部距離 
android:gravity="left" //空間佈局位置 
android:layout_marginLeft="15dip //距離左邊距 

// 相對於給定ID控件 
android:layout_above 將該控件的底部置於給定ID的控件之上; 
android:layout_below 將該控件的底部置於給定ID的控件之下; 
android:layout_toLeftOf    將該控件的右邊緣與給定ID的控件左邊緣對齊; 
android:layout_toRightOf  將該控件的左邊緣與給定ID的控件右邊緣對齊; 
android:layout_alignBaseline  將該控件的baseline與給定ID的baseline對齊; 
android:layout_alignTop        將該控件的頂部邊緣與給定ID的頂部邊緣對齊; 
android:layout_alignBottom   將該控件的底部邊緣與給定ID的底部邊緣對齊; 
android:layout_alignLeft        將該控件的左邊緣與給定ID的左邊緣對齊; 
android:layout_alignRight      將該控件的右邊緣與給定ID的右邊緣對齊; 

android:layout_alignStart//在從又向左排版的文字中,等同於android:layout_alignRight,普通文字排版等同於android:layout_alignRight

android:layout_alignEnd//類似上面的解釋
// 相對於父組件 
android:layout_alignParentTop      如果爲true,將該控件的頂部與其父控件的頂部對齊; 
android:layout_alignParentBottom 如果爲true,將該控件的底部與其父控件的底部對齊; 
android:layout_alignParentLeft      如果爲true,將該控件的左部與其父控件的左部對齊; 
android:layout_alignParentRight    如果爲true,將該控件的右部與其父控件的右部對齊; 
// 居中 
android:layout_centerHorizontal 如果爲true,將該控件的置於水平居中; 
android:layout_centerVertical     如果爲true,將該控件的置於垂直居中; 
android:layout_centerInParent   如果爲true,將該控件的置於父控件的中央; 
// 指定移動像素 
android:layout_marginTop      上偏移的值; 
android:layout_marginBottom 下偏移的值; 
android:layout_marginLeft   左偏移的值; 
android:layout_marginRight   右偏移的值;

5.全屏樣式

UI Editor選擇DeviceDefault.NoActionBar.Fullscreen



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章