Time of Update: 2018-12-04
package com.android.tabhost;import android.app.TabActivity;import android.graphics.Color;import android.os.Bundle;import android.util.Log;import android.view.LayoutInflater;import android.widget.TabHost;import
Time of Update: 2018-12-04
1.ACTIVITY 在XML檔案中要配置如下:其中 <data android:scheme="file"/>標示來自於檔案瀏覽,<data android:scheme="content"/>標示來自於網路 <data android:mimeType="audio/*"/> <data android:mimeType="application/ogg"/> <data
Time of Update: 2018-12-04
Android視覺規範-間距規範與文字規範單位換算(dip、sp與px) (2012-03-11 22:07:32)轉載▼標籤:it分類:
Time of Update: 2018-12-04
在開發中用到了需要ScrollView嵌套GridView,或者嵌套listview,或者listview嵌套listview等的情況,由於這兩款控制項都內建捲軸,當他們碰到一起的時候便會出問題,即GridView(子view)內容會顯示不全。解決辦法,自訂一個GridView控制項或者 listviewpublic class MyGridView extends GridView { public MyGridView(Context context, AttributeSet attrs)
Time of Update: 2018-12-04
在android中,一個activity組件可以啟用另一個activity組件(可能屬於另一個應用程式)。
Time of Update: 2018-12-04
項目中遇到控制項跟隨手指觸摸移動的部分,簡單測試了下。package com.example.viewanimationtest;/** * @author maria * 2013-2-16 */import android.os.Bundle;import android.app.Activity;import android.view.MotionEvent;import android.view.View;import android.view.View.OnTouchListener;
Time of Update: 2018-12-04
無論怎麼小心,想完全避免bad code是不可能的,此時就需要一些工具來協助我們檢查代碼中是否存在會造成記憶體流失的地方。Android tools中的DDMS就帶有一個很不錯的記憶體監測工具Heap(這裡我使用eclipse的ADT外掛程式,並以真機為例,在模擬器中的情況類似)。用 Heap監測應用進程使用記憶體情況的步驟如下:1. 啟動eclipse後,切換到DDMS透視圖,並確認Devices視圖、Heap視圖都是開啟的;2.
Time of Update: 2018-12-04
第一種方法: String path = "file:///android_asset/檔案名稱";第二種方法: InputStream abpath = getClass().getResourceAsStream("/assets/檔案名稱");若要想要轉換成String類型String path = new String(InputStreamToByte(abpath )); private byte[]
Time of Update: 2018-12-04
簡介:Android 是一款基於 Linux 核心,面向移動終端的作業系統。為適應其作為移動平台作業系統的特殊需要,Google對其做了特別的設計與最佳化,使應用程式關閉但不退出,並由作業系統進行進程的回收管理。本文在 Application Framework 與 Linux 核心兩個層次上,以進程為粒度,對 Android 作業系統的進程資源回收機制進行了剖析。讀者可以從本文獲得對 Android 應用程式的生存周期的進一步理解,從而更加合理、高效地構建應用程式。Android APP
Time of Update: 2018-12-04
重新開始寫部落格 之前的JAVA部落格一直沒更新,一直忙,連地址都忘了,現在下定決心重新拾起。一邊學習android 一邊溫習java基礎。現在明白忙只是借口,真正的原因是因為太懶了,肯定能擠出時間學習總結,至少每周末會寫一到兩篇學習總結,下定決心堅持下來,恩,為自己加油。-------------------------------------------------------------------Android中對組合模式的應用,可謂是泛濫成粥,隨處可見,那就是View和View
Time of Update: 2018-12-04
一、必備軟體1、jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008.exe。2、eclipse-SDK-3.4.2-win32.zip。 3、ADT-0.9.0.zip。4、android-sdk-windows-1.5_r1.zip。版本不同可能會導致不相容。出現各種錯誤。請上網查詢。 二、安裝過程1、jdk 1.6安裝(雙擊jdk-6u10-rc2-bin-b32-windows-i586-p-12_sep_2008.exe)。選擇安裝路徑為“E:
Time of Update: 2018-12-04
由於各種反編譯工具的泛濫,作為Android程式員在2.3版本以前只能通過手動添加proguard來實現代碼混淆proguard這個工具是一個java代碼混淆的工具在2.3版本的sdk中 我們可以看到在android-sdk-windows/tools/下面多了一個proguard檔案夾google已經把proguard技術放在了android sdk裡面
Time of Update: 2018-12-04
首先獲得軟鍵盤的對象InputMethodManager imm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);然後註冊空白處的touch事件if (event.getAction() == MotionEvent.ACTION_DOWN) {System.out.println("down");if (RegisterActivity.this.getCurrentFocus() != null)
Time of Update: 2018-12-04
第一種方法是用系統的資源,這種方法只能將進度情況顯示到標題列中。英文是本文作者的一段嘮叨,很簡單,我就不用再翻譯了吧。When using the webview, something that drives me crazy, specially if you are in a place with a very slow internet connection, is not knowing what is happening with the webpage, is it loading?
Time of Update: 2018-12-04
範例說明 “如何在和機上繪製2D圖形呢?”這是許多android遊戲開發都是常提到的問題,在android SDK 當中,並沒有Java Graphics2D的函數可以使用,而是使用android.graphics底下的類來繪製2D向量圖。這個package提供了許多在手機上繪製圖形的類與方法,其中Canvas上,而Paint(Android.graphics.Paint)類則像是彩色鉛筆,給予不同的調協,即可繪製不同顏色、不同種類效果的向量圖形。
Time of Update: 2018-12-04
下面和大家分享一個實際工作中經常使用的TabWidget標籤分頁技術,先看一下效果: 下面和大家分享一下實現代碼:MainActivity.javapackage com.zyb.tab;import android.app.TabActivity;import android.content.Intent;import android.os.Bundle;import android.widget.TabHost;import
Time of Update: 2018-12-04
android 中擷取通訊錄中連絡人資訊,代碼如下: /** * 擷取連絡人資訊,包括:名稱、號碼、頭像 * @return */ private ArrayList<PhoneContactor> getPhoneContacts(){ Log.i(TAG, "getPhoneContacts"); ContentResolver
Time of Update: 2018-12-04
Platform VersionAPI Level Symbol Android 3.011 Honeycomb (蜂巢)Android 2.3.310 Gingerbread (薑餅) Android 2.39 Gingerbread (薑餅) Android 2.28 Froyo ( 凍優酪乳) Android 2.17 Eclair (法式奶油夾心甜點) / Flan (水果餡餅) Android 2.0.16 Eclair (法式奶油夾心甜點) Android 2.05 Eclair (
Time of Update: 2018-12-04
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mysrc" android:versionCode="1" android:versionName="1.0"> <application
Time of Update: 2018-12-04
RatingBar: 1、RatingBar的layout_width若是“fill_parent”,星號會超屏 2、getRating()/setRating(float) ImageView: 1、使用setImageResources(int imageId) ImageButton: 1、在drawable-mdpi檔案夾中建立xml檔案,指定控制項的游標事件,點擊事件等,