【Android】 分享一個完整的項目,適合新手!

來源:互聯網
上載者:User

標籤:android   blog   http   io   ar   os   使用   sp   java   

寫這個app之前是因為看了頭條的一篇文章:http://www.managershare.com/post/155110,然後心想要不做一個這樣的app,讓手機計算就行了。也就沒多想就去開始整了。

 項目用到了三個開源包: 一個是圖片載入:https://github.com/nostra13/Android-Universal-Image-Loader 使用方法: 1.在Appliction的onCreate裡初始化
/** * 初始化imageLoader */public void initImageLoader() {File cacheDir = StorageUtils.getCacheDirectory(getApplicationContext());ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).memoryCache(new LruMemoryCache(5 * 1024 * 1024)).memoryCacheSize(10 * 1024 * 1024).discCache(new UnlimitedDiscCache(cacheDir)).discCacheFileNameGenerator(new HashCodeFileNameGenerator()).build();ImageLoader.getInstance().init(config);}public DisplayImageOptions getOptions(int drawableId) {return new DisplayImageOptions.Builder().showImageOnLoading(drawableId).showImageForEmptyUri(drawableId).showImageOnFail(drawableId).resetViewBeforeLoading(true).cacheInMemory(true).cacheOnDisc(true).imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).build();}

  2.使用時調用:

ImageLoader.getInstance().displayImage(avatarUrl,holder.mImage,MyApplication.getInstance().getOptions(R.drawable.user_icon_default_main),new SimpleImageLoadingListener() {@Overridepublic void onLoadingComplete(String imageUri,View view, Bitmap loadedImage) {super.onLoadingComplete(imageUri, view, loadedImage);}});
 一個是下拉重新整理:https://github.com/johannilsson/android-pulltorefresh 使用方法:
// 設定PullToRefreshmListView.setMode(Mode.BOTH);mListView.setOnRefreshListener(new OnRefreshListener2<ListView>() {// 下拉Pulling Down@Overridepublic void onPullDownToRefresh(PullToRefreshBase<ListView> refreshView) {String label = DateUtils.formatDateTime(MainAct.this,System.currentTimeMillis(), DateUtils.FORMAT_SHOW_TIME| DateUtils.FORMAT_SHOW_DATE| DateUtils.FORMAT_ABBREV_ALL);refreshView.getLoadingLayoutProxy().setLastUpdatedLabel(label);mListView.setMode(Mode.BOTH);pullFromUser = true;mRefreshType = RefreshType.REFRESH;pageNum = 0;lastItemTime = getCurrentTime();//擷取資料fetchData();}// 上拉Pulling Up@Overridepublic void onPullUpToRefresh(PullToRefreshBase<ListView> refreshView) {// 上拉的時候添加選項mRefreshType = RefreshType.LOAD_MORE;//擷取資料fetchData();}});actualListView = mListView.getRefreshableView();actualListView.setFastScrollEnabled(true);mEntities = new ArrayList<RankEntity>();mAdapter = new MainListAdapter(MainAct.this, mEntities);actualListView.setAdapter(mAdapter);if (mEntities.size() == 0) {fetchData();}mListView.setState(State.RELEASE_TO_REFRESH, true);

  

一個是嚮導流程:https://github.com/TechFreak/WizardPager 這個源碼包有修改過,只使用了單選這個Fragment!內容比較多想看的下載代碼吧  項目雖然很渣很沒新意,完成是出於一個瞬間的念頭,開發完成後自己測試都覺得無聊,40多個選擇,點到手抽筋!然後又加上了一個自動翻頁的開關!
 apk下載:http://openbox.mobilem.360.cn/index/d/sid/2313363原始碼下載:http://www.eoeandroid.com/thread-555168-1-1.html QQ:471497524:519659991 新開的交流群,歡迎廣州的開發人員加入: http://jq.qq.com/?_wv=1027&k=cgvXpA,另外群裡有一個HR需要找一位1年工作經驗以上,能夠獨立開發App的安卓哥,正在找工作的一定要加這個群阿 最後附:

 

【Android】 分享一個完整的項目,適合新手!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.