步驟: 1. 在activity_main.xml裡面定義一個ListView 2. 寫一個adapter繼承自BaseAdapter a. 重寫BaseAdapter的getView函數需要注意對converView進行判空操作,可以使用配合ViewHolder一起使用,效率更好(想想如果沒有使用ViewHolder,該怎麼重寫getView就能明白viewholder的作用) 3. 把activity_main.xml中的ListView和adapter進行綁定 a.
Beauty of Array Time Limit: 2 Seconds Memory Limit: 65536 KB Edward has an array A with N integers. He defines the beauty of an array as the summation of all distinct integers in
摘要: 項目需要使用Apache Tiles,現在學習下並留下相關記錄,以待或續查看及大家相互學習。 Apache Tiles 是什麼。 A free open-sourced templating framework for modern Java applications. Based upon the Composite pattern it is built to simplify the development of user
viewpager是幾乎每個項目都用的 ,有的時候 頁面複雜一些需要動態改變每個item的高度,因此需要進行解決。解決方案如下: 首先如果對其進行wrapcontent需要自訂viewpager重寫它的onmeasure方法,在裡面進行處理 處理之後重新設定viewpager的高度為0 即可解決。看如下代碼 /** * Created by longcai:zhangyu on 17/3/14. */public class WrapContentViewPager
viewpager的預先載入是很煩人的 因此為瞭解決這個預先載入找了很多方案,在github上面有自訂viewpager實現它的懶載入,我感覺還是挺複雜的,為此我看了一下viewpager的源碼,如下 /** * Set the number of pages that should be retained to either side of the * current page in the view hierarchy in an idle state. Pages beyond