Time of Update: 2018-12-04
為了添加相框,可以建立一個bitmap,依此執行個體化一個canvas。然後再上面依次畫上原圖和相框。在onPictureTaken()函數裡,得到原始bitmap後,得到相框,然後調用融合函數。Bitmap frame = BitmapFactory.decodeResource(getResources(), R.drawable.border); Bitmap monBM = montageBitmap(frame, sizeBitmap, 200, 200); /*將像框和圖片進行融合,
Time of Update: 2018-12-04
你的ImageView只有128*96像素的大小,只是為了顯示一張縮圖,這時候把一張1024*768像素的圖片完全載入到記憶體中顯然是不值得的。所以我們需要一個方法來解決這個問題。public static int calculateInSampleSize(BitmapFactory.Options options,int reqWidth, int reqHeight) {// 源圖片的高度和寬度final int height = options.outHeight;final int
Time of Update: 2018-12-04
轉自: http://blog.csdn.net/larryl2003/article/details/6919513ImageView的Scaletype決定了圖片在View上顯示時的樣子,如進行何種比例的縮放,及顯示圖片的整體還是部分,等等。設定的方式包括:1. 在layout xml中定義android:scaleType="CENTER"2.
Time of Update: 2018-12-04
Basic4android 1.8,用 Basic 編寫 Android 應用 Basic4android v1.8 發布,該版本包含眾多新特性:代碼編輯器- Automatic case correction of variables and subs (based on their declaration)- Highlighting of undeclared variables- Highlighting of global variables- "Find all
Time of Update: 2018-12-04
Android 開發有時需要在一個應用中啟動另一個應用,比如Launcher載入所有的已安裝的程式的列表,當點擊表徵圖時可以啟動另一個應用。 一般我們知道了另一個應用的包名和MainActivity的名字之後便可以直接通過如下代碼來啟動: Intent intent = newIntent(Intent.ACTION_MAIN); 2intent.addCategory(Intent.CATEGORY_LAUNCHER); 3ComponentName cn =
Time of Update: 2018-12-04
dip不是像素密度,像素密度是dpi,引用句原話dip: device independent pixels(裝置獨立像素). 不同裝置有不同的顯示效果,這個和裝置硬體有關,一般我們為了支援WVGA、HVGA和QVGA
Time of Update: 2018-12-04
代碼如下:AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);audioManager.setMicrophoneMute(false);
Time of Update: 2018-12-04
得到裝置的物理尺寸,注意,不是解析度!從一個外國的文章上找到的答案http://stackoverflow.com/questions/2193457/is-there-a-way-to-determine-android-physical-screen-height-in-cm-or-inches DisplayMetrics dm = new DisplayMetrics();
Time of Update: 2018-12-04
很多初學Android遊戲開發的朋友,往往會顯得有些無所適從,他們常常不知道該從何處入手,每當遇到自己無法解決的難題時,又往往會一邊羨慕於 iPhone下有諸如Cocos2d-iphone之類的免費遊戲引擎可供使用,一邊自暴自棄的抱怨Android平台遊戲開發難度太高,又連個像樣的遊
Time of Update: 2018-12-04
類比發送Http請求我們可以使用HttpURLConnection類進行操作,但是Android平台整合了功能強大且編寫更容易的commons-httpclient.jar,因此在這裡介紹如何通過commons-httpclient進行Http請求。發送Http請求可以有兩種方式:一種是同步,一種是非同步。由於我對非同步不是很熟悉,所以這裡先提供同步方式發送Http請求:1、使用Get方式發送public String httpGet(String url, String params)
Time of Update: 2018-12-04
關於Android中的radioGroup選擇xml定義如下:<RadioGroup android:id="@+id/sex" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal"
Time of Update: 2018-12-04
android 從tomcat讀取檔案時出現以下異常:08-10 14:53:09.118: W/System.err(12527): java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 8080):connectfailed: ECONNREFUSED (Connection refused)08-10 14:53:09.118: W/System.err(12527): at
Time of Update: 2018-12-04
抓包工具TcpDump for Android + wireshark如果要抓TCP資料包,我們可以使用TCPdump工具,類似於windows/linux下使用的這個工具一樣。具體方法是下載tcpdump,還有個地址是http://www.strazzere.com/android/tcpdump。詳細使用請參考http://www.tcpdump.org/裡面的文檔你需要root許可權,adb push
Time of Update: 2018-12-04
前面的例子顯示的正方形都是白色,看其來不是很吸引人,本篇介紹如何給Mesh(網格)添加顏色。OpenGL ES使用顏色是我們熟知的RGBA模式(紅,綠,藍,透明度)。顏色的定義通常使用Hex格式0xFF00FF 或十進位格式(255,0,255), 在OpenGL 中卻是使用0…1之間的浮點數表示。 0為0,1相當於255(0xFF)。最簡單的上色方法叫做頂點著色(Vertxt coloring),可以使用單色,也可以定義色彩坡形或者使用材質(類同於二維圖形中各種Brush類型)。Flat
Time of Update: 2018-12-04
Android 仿之首頁面實現篇Android 仿之介面導航篇Android 高仿QQ 好友分組列表Android 高仿QQ 介面滑動效果Android 高仿QQ 登陸介面Android 對Path的旋轉效果的拓展Android高仿360安全衛士布局源碼Android SlidingDrawer
Time of Update: 2018-12-04
android源碼編譯步驟說明一、JDK安裝 1 .修改源: sudo gedit/etc/apt/sources.list 所有替換為mirrors.163.com網址 2.更新源: sudo apt-get update 3.安裝jdk5.0: (1)解壓jdk1.5.0_22.tar.bz2 sudo tar -jxvfjdk1.5.0_22.tar.bz2 -C //usr/local/ (2
Time of Update: 2018-12-04
在開發Andorid程式的時候,難免會牽扯到退出整個應用程式的情況,怎麼完全退出呢?請參閱下面的關鍵代碼: import java.util.LinkedList; import java.util.List; import Android.app.Activity; import Android.app.AlertDialog; import Android.app.Application; import Android.content.DialogInterface;
Time of Update: 2018-12-04
一些小問題: 在ubuntu等linux系統下,最高許可權的帳號是root帳號,這個帳號就相當於windows系統中的administrator帳號,但是預設下root是沒法登入的,因為我們不知道root的密碼,那麼怎麼處理呢?開啟一個終端,輸入命令sudo passwd root之後就可以重設root的密碼了,之後就可以用root帳號登入了~~今天自己在筆記本裡安裝了VmWare和Ubuntu,安裝完Ubuntu後,安裝Vm Tools遇到了些小小的麻煩。Google之,找到瞭解決辦法。(
Time of Update: 2018-12-04
Using EclipseThis document will help you set up the Eclipse IDE for Android platform development.Note: if you are looking for information on how to useEclipse to develop applications that run on Android, this is not the rightpage for you. You
Time of Update: 2018-12-04
一,0許可權重啟手機: 現在我們來定義一個實現該功能的類:/** * 單擊事件 * @param view */ public void reboot(View view) { Intent reboot = new Intent(Intent.ACTION_REBOOT); reboot.putExtra("nowait", 1); reboot.putExtra("interval", 1); reboot.putExtra("window", 0);