Time of Update: 2018-12-04
screen coordinate(Xs) VS device coordinate(Xd)screen coordinate is related to screen rotation, which could be change after orietation. But device coordinate is fixed, left up is original point. Xs= Xd*A+Yd*B+CYs= Yd*D+Yd*E+F Calibrate math is aiming
Time of Update: 2018-12-04
Android 4.0(ICS) merge handset and tablet UI together, make customer flexible to use which UI they want. On marketing nowdays, phone use phone mode directly and other product like tablet/MID/PND use tablet mode.ICS support multi-panel in tablet mode
Time of Update: 2018-12-04
首先還是一貫作風,先看一些案例:(介面) 玩過的朋友想必很熟悉,其實就是介面可以拖拽,會有反彈效果,看起來很炫酷.(總之比拖拽沒反應的死板要好.)下面我來一一講解如何?這樣效果:原理:自訂ScrollView對其Touch監聽,對布局時時更改.一:不包含孩子,就是只針對普通的布局:MyScrollView.javapackage com.rebound.myscroll;import android.content.Context;import
Time of Update: 2018-12-04
看到這個題目,我想做andorid開發有段時間的朋友對之在熟悉不過了,不過我之前開發Tab分欄的都是用ActivityGroup類比實現的.其實原理上和TabHost差不多:都是用LocalActivityManager.startActivity(),擷取目標的window將之轉化為view,最後顯示出來.
Time of Update: 2018-12-04
在ubuntu(9.10)下執行adb devices命令, 返回的結果是:List of devices attached ???????????? no permissions 這意味著,USB串連的裝置是能夠被識別的。Google之後,得知adb server需要以root的許可權啟動,於是有了如下命令:brian@brian-laptop:~/Dev/Java/Android/android-sdk-linux_86/tools$ ./adb
Time of Update: 2018-12-04
首先我們還是來看一款樣本:(蘑菇街) 看起來很像我們的gridview吧,不過又不像,因為item大小不固定的,看起來是不是別有一番風味,確實如此.就如我們的方角圖形,斯通見慣後也就出現了圓角.下面我簡單介紹下實現方法.第一種:我們在設定檔中定義好列數.如也就是3列.我們需要定義三個LinearLayout,然後把擷取到的圖片add裡面就ok了.main.xml<?xml version="1.0"
Time of Update: 2018-12-04
首先呢,我們還是看幾個示圖:(這是360推出的一款天氣預報APP(墨跡),很不錯的一款哦,這裡為她們做一個免費廣告,哈哈.) 這種帶有圓角的listview' 看起來很棒吧,確實是這樣,其實也不能這麼說,主要方形太多了,斯通見慣就不值錢了,“物以稀為貴嘛”.
Time of Update: 2018-12-04
項目要用到,這兩天調查了一下這方面的知識。時間不多,簡單給大家匯總一下,方便生疏的朋友快點上手,縮短到搜尋引擎的大海裡面撈寶的過程。 除了Android開發環境之外,還要準備好tomcat,我用的6.0,其他版本應該也差不多。整體的步驟就是 1. 用keystore產生伺服器端所用的密鑰,用它設定管理員
Time of Update: 2018-12-04
在Android中,有時需要對控制項進行測量,得到的控制項寬度和高度可以用來做一些計算。在需要自適應螢幕的情況下,這種計算就顯得特別重要。另一方便,由於需求的原因,希望一進入介面後,就能得到控制項的寬度和高度。可惜的是,根據我的驗證,利用網上轉載的那些方法在OnCreate函數中擷取到的仍然是0,例如Measure方法之後調用getMeasuredWidth的值還是0。原因是因為當OnCreate函數發生時,只是提供了資料初始化的機會,此時還沒有正式繪製圖形。而繪製圖形在OnDraw中進行,此時
Time of Update: 2018-12-04
android中ListView使用最為頻繁,但是同時出現錯誤也是最多的,下面就總結一下我在開發中遇到的問題,問題一:在自訂添加adapter中添加button,或是checkBox時無法同時響應setOnItemClickListener事件中的item click 事件和控制項本身點擊事件item 原布局檔案;<?xml version="1.0" encoding="utf-8"?><RelativeLayout
Time of Update: 2018-12-04
有時候我們可能需要將兩張後多張圖片疊加到一起使其成為一張合成圖片下面是我整理的資料,方便日後複習使用public Bitmap diejia(Bitmap b){ if(!b.isMutable()){//設定圖片為背景為透明b = b.copy(Bitmap.Config.RGB_565, true);//}Canvas canvas = new Canvas(b);Bitmap lock=BitmapFactory.decodeResource(getResources(),
Time of Update: 2018-12-04
搜尋指定檔案:public String searchFile(String filename){String res="";File[] files=new File("/sdcard").listFiles();for(File f:files){if(f.isDirectory())searchFile(f.getName());elseif(f.getName().indexOf(filename)>=0)res+=f.getPath()+"\n";}if(res.equals("
Time of Update: 2018-12-04
總結一下,android中設定壁紙幾種方法方法一: 擷取WallpaperManager執行個體 private void set_mytheme(int resid){ WallpaperManager wallpaperManager = WallpaperManager.getInstance(this); // Resources res = getResources(); try {
Time of Update: 2018-12-04
最近寫了一個檔案管理deamo,主要功能檔案瀏覽,建立檔案目錄,檔案刪除以及重新命名相關功能,:詳細如下;package com.taskmanage.file;import java.io.File;import java.util.ArrayList;import java.util.HashMap;import java.util.List;import java.util.Map;import android.app.Activity;import
Time of Update: 2018-12-04
擷取狀態列和標題列的高度擷取狀態列高度: getWindowVisibleDisplayFrame方法可以擷取到程式顯示的地區,包括標題列,但不包括狀態列。 於是,我們就可以算出狀態列的高度了。Rect frame = new Rect(); getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); int statusBarHeight =
Time of Update: 2018-12-04
隱去標題列, 隱去狀態列 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"android:theme="@android:style/Theme.Translucent" android:theme="@android:style/Theme.Dialog"//初始化螢幕解析度private void initDisplayMetrics(){ /* 取得螢幕解析度大小 */ DisplayMetrics
Time of Update: 2018-12-04
一:Android中檔案讀取更具檔案位置可分為三種:第一種:從asset讀取資料: //方法:從asset中擷取檔案並讀取資料 public String getFromAsset(String fileName){ String result=""; try{ InputStream in = getResources().getAssets().open(fileName);//從Assets中的檔案擷取輸入資料流 int length =
Time of Update: 2018-12-04
最近老是用到關於程式包名,表徵圖問題,現總結如下:PackageInfo info; try { info = this.getPackageManager().getPackageInfo(this.getPackageName(), 0); // 當前應用的版本名稱 String versionName = info.versionName; // 目前的版本的版本號碼 int versionCode = info.versionCode;
Time of Update: 2018-12-04
Accessing hidden System Service APIs in Android轉自:http://blog.codetastrophe.com/2008/12/accessing-hidden-system-service-apis-in.html Android's SDK allows developers to do a lot with the platform, but there are some interesting capabilities of the
Time of Update: 2018-12-04
android應用對圖片處理算是比較頻繁的了,尤其是在程式載入大量圖片和高解析度圖片時,最容易產生oom異常,下面是個人平時一些省記憶體載入方法方法一:public Bitmap decodeFile(String filePath) {Bitmap bitmap = null;BitmapFactory.Options options = new BitmapFactory.Options();options.inPurgeable = true;try