原创 【Android】07、EditText控件

1、EditText一般的寬度設置不用wrap_content       可以用match_parent充滿父容器,也可以設置固定值例如180dp 2、提示信息"請輸入:"這個文本不用android:text屬性,因爲影響getText

原创 【Android】17、創建多個Activity

1、創建secondactivity.xml佈局文件(注意名稱不支持大寫字母) <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://sche

原创 【Android】14、SimpleAdapter

1、使用SimpleAdapter實現圖文混編 在佈局文件中編寫代碼 ——添加ListView標籤(main.xml) ——編寫行佈局文件(item.xml) 2、在Activity中編寫代碼 ——獲取ListView對象 ——準備數據源

原创 【Android】05、Button按鈕

1、Button的基本屬性 <Button          android:id="@+id/btn"          android:text="@string/button"          android:textSize="

原创 【Android】10、Android開發中常用的佈局

1、佈局的作用。 ——不可見的視圖容器組件 ——負責管理其子控件在屏幕中顯示的位置和大小   2、常見的幾種佈局類型 ——線性佈局  LinearLayout ——相對佈局 RelativeLayout ——幀佈局      FrameL

原创 【Android】06、監聽按鈕點擊事件

1、監聽按鈕點擊事件的步驟。 1)獲取控件對象 2)註冊監聽器 3)編寫響應代碼   2、註冊監聽的方式有3種。 1)匿名內部類   //獲取Button按鈕的對象 Button btn = (Button) findViewById(R

原创 【Android】08、ImageView控件

1、ImageView語法。 <ImageView   android:id="@+id/img_logo"   android:backgroud="@mipmap/ic_launcher"   android:src="@mipmap

原创 【Android】15、活動的生命週期

————————活動第一次運行時 onCreate() onStart() onResume() ————————按下BACK鍵 onPause() onStop() onDestroy() ————————長按HOME鍵,然後點擊該活