第二種方法也要建立一個圖片+文字的xml布局檔案,然後寫一個類繼承自LinearLayout。在主程式裡執行個體化並設定相應參數。這種方式也是我最推薦的一種。第一部分:myimgbtn_layout.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
獲得日升日落時間的關鍵代碼就是下面這個服務,當然要去manifest裡註冊和啟動這個服務package com.android.options;import android.app.Service;import java.io.BufferedReader;import java.io.File;import java.io.FileNotFoundException;import java.io.FileOutputStream;import
總共12部分,有12個文檔,下面有我從裡面隨便截的幾個圖,如過覺得不錯,就下載。01_Android系統概述02_Android系統的開發綜述03_Android的Linux核心與驅動程式04_Android的底層庫和程式05_Android的JAVA虛擬機器和JAVA環境06_Android的GUI系統07_Android的Audio系統08_Android的Video_輸入輸出系統09_Android的多媒體系統10_Android的電話部分11_Android的串連部分12_Android
在appWidget中,ImageButton和Button都是被支援的控制項,其事件可分成三種類型:一、開啟Activity二、開始Service三、發送按鈕Action下面開始一個一個分析,如何?。一、開啟Activity1、首先先定義個開啟Activity的intenteg: Intent fullIntent=new Intent(this,FullScreen.class);若要傳遞資料,則使用intent.putExtra()方法eg:
一.@代表引用資源1.引用自訂資源。格式:@[package:]type/nameandroid:text="@string/hello" 2.引用系統資源。格式:@android:type/name android:textColor="@android:color/opaque_red" 注意:其實@android:type/name 是@[package:]type/name 的一個子類二.@*代表引用系統的非public資源。格式:@*android:type/name 系統資
1、Drawable --> Bitmap Bitmap drawable2Bitmap(Drawable drawable) { if (drawable instanceof BitmapDrawable) { return ((BitmapDrawable) drawable).getBitmap(); } else if (drawable instanceof NinePatchDrawable) {
網上軟應用的例子很多,我也是借鑒別人修改了下,推薦一個網址:http://www.iteye.com/topic/685986 之前總是不太理解,今天認真的推敲下,記錄下來方便以後用到. HashMap<String, SoftReference<Drawable>> imageCache 關於SoftReference這個類多少知道些機制,會用就ok了。
首先還是一貫作風,請大家先看一些圖例: 在上一篇介紹了地圖顯示自己的位置,在這一篇呢,我簡單介紹下在地圖如何show出來一系列POI(興趣點) 首先我們從伺服器拉取要標記POI的資訊如(lat,lon,Tag等資訊)然後就是根據經緯度建立ItemizedOverlay.這個是用於顯示一系列的POI. 程式碼片段: 在onLocationChanged調用:/*** * Location 監聽 * * @param arg0 */@Overridepublic
/* * function:傳入參數建立自訂的顯示Dialog * title:dialog的訊息體 * bt1:按鈕上的text * bt2:按鈕上的text * author:dy * time:12-08-14 */private Dialog createMyDialog(String title,String bt1,String bt2) {AlertDialog.Builder dialogBuilder = new
編譯1. 下載安裝 Android NDK,不必贅述。假定我們安裝到了 /Developer/android-ndk-r4b/.2. 在工作目錄下建立一個 jni 目錄。如果要使用 NDK 內建的 Android.mk,必須叫做這個名字,否則 make 的時候會找不到檔案,錯誤提示可能類似下面:Android NDK: Could not find application project directory !Android NDK: Please define the NDK_PROJECT_
先看;詳細看代碼;package com.taskmanage.file;import java.util.ArrayList;import java.util.Collections;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Map;import android.app.Activity;import
最近總結了一下Android中對圖片處理方法,具體如下:/** * 圖片反轉 * @param img * @return */public Bitmap toturn(Bitmap img){Matrix matrix = new Matrix();matrix.postRotate(90); /*翻轉90度*/int width = bitmap.getWidth();int height =bitmap.getHeight();img = Bitmap.createBitmap(img,
Android調用打電話,發簡訊功能可分為直接調用和間接調用,通過設定intent屬性即可實現:直接調用,不經過使用者確認://電話 Intent intent = new Intent( Intent.ACTION_CALL, Uri.parse("tel:10086")); startActivity(intent); //簡訊String smsContent = "ye";
擷取mac地址:public String getLocalMacAddress() { WifiManager wifi = (WifiManager) getSystemService(Context.WIFI_SERVICE); WifiInfo info = wifi.getConnectionInfo(); return info.getMacAddress(); } 或者:private String
程式想告訴Android系統自己能夠響應和處理哪些Intent,那麼就需要用到IntentFilter對象,IntentFilter對象負責過濾掉組件能夠處理的Intent請求,隱式Intent(Explicit Intents)和Intent Filter(Implicit
1,調web瀏覽器Uri myBlogUri = Uri.parse("http://www.soqi.cc");returnIt = new Intent(Intent.ACTION_VIEW, myBlogUri);2,地圖Uri mapUri = Uri.parse("geo:38.899533,-77.036476");returnIt = new Intent(Intent.ACTION_VIEW, mapUri);3,調撥打到電話介面Uri telUri =
總結一下android
使用用ADW的Launcher的人應該有點印象裡面的功能,就是拖拽應用或者Widget表徵圖到刪除表徵圖上,停留1秒以上,則會顯示"Drop to uninstall"的提示,放開則開啟卸載該程式的介面,現在就是要分析模仿這個功能。 主要用到有兩方面的東西,卸載和停留提示。卸載主要使用的是:Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, Uri.parse("package:" + mUninstallPkg));
在android系統中,有一些初始化的設定檔,例如:/init.rc/default.prop/system/build.prop檔案裡面裡面配置了開機設定的系統屬性值, 這些屬性值,可以通過getprop擷取,setprop設定,它的格式如下:getprop [key]擷取指定key的配置值,如果不帶參數,只是getprop則是顯示系統所有的配置值。[dalvik.vm.heapsize]: [24m][curlockscreen]: [1][ro.sf.hwrotation]:
第一種相對簡單和常用吧~因為目前我開發到的東西都是用這種:代碼如下;public class Actjava extends Activity{public void onCreate(Bundle savedInstanceState){super onCreate(savedInstanceState);setContentView(R.layout.main);Button button =