Android開發中非常實用的方法,API等

2021-07-16 19:24:05 字數 2863 閱讀 4844

linkview.settext(

html.fromhtml(

"fromhtml:b> \t click " +

"href=\"">herea> " +

"to visit my website "

));

if (build.version

.sdk_int >= build.version_codes.honeycomb)

/**

* blend and using the given ratio.

**@param ratio of which to blend. 1.0 will return , 0.5 will give an even blend,

* 0.0 will return .

*/private

static

intblendcolors(int color1, int color2, float ratio)

boolean isenabled = settings.system

.getint(context.getcontentresolver(), settings.system

.airplane_mode_on, 0) == 1

;

遍歷hashmap的最佳方法

public static void printmap(map mp) 

}

public static int randint(int

min, int

max)

flag

解釋start_sticky

如果service程序被kill掉,保留service的狀態為開始狀態,但不保留遞送的intent物件。隨後系統會嘗試重新建立service,由於服務狀態為開始狀態,所以建立服務後一定會呼叫

onstartcommand

(intent,int,int)方法。如果在此期間沒有任何啟動命令被傳遞到service,那麼引數intent將為null。

start_not_sticky

「非粘性的」。使用這個返回值時,如果在執行完onstartcommand後,服務被異常kill掉,系統不會自動重啟該服務。

start_redeliver_intent

重傳intent。使用這個返回值時,如果在執行完onstartcommand後,服務被異常kill掉,系統會自動重啟該服務,並將intent的值傳入。

start_sticky_compatibility

start_sticky的相容版本,但不保證服務被kill後一定能重啟。

public static bitmap blurbitmap(context context, bitmap src, int radius)
public bitmap createviewbitmap(view v)
/**

* 擷取scrollview的螢幕

*@param scrollview

*@return

*/public

static bitmap getbitmapbyview(scrollview scrollview)

// 建立對應大小的bitmap

bitmap = bitmap.createbitmap(scrollview.getwidth(), h,

bitmap.config.rgb_565);

final canvas canvas = new canvas(bitmap);

scrollview.draw(canvas);

return bitmap;

}

android:layout_width="match_parent"

android:layout_height="wrap_content"

tools:text="這段話只在預覽時能看到,執行以後就看不到了" />

android 

}...

compileoptions

}

git rm -r --cached .

git add .

git commit -m 'update .gitignore'

name="android:layout_width">wrap_contentitem>

name="android:layout_height">wrap_contentitem>

這樣,控制項的寬高預設都是wrap_content樣式啦。

name="android:layout_width">fill_parentitem>

name="android:layout_height">fill_parentitem>

context類中的createpackagecontext(packagename, flags)方法,可用來獲取指定包名應用程式的context物件。

textview類的setkeylistener(keylistener)方法; 其中digitskeylistener類,使用getinstance(string accepted)方法即可指定edittext可輸入字符集;

view類中的getlocationinwindow(int)方法和getlocationonscreen(int)方法,獲取view在視窗/螢幕中的位置;

staticlayout 在自定義控制項繪製文字的時候很有用。

Matlab中非常實用的快捷鍵和命令

1.在命令視窗 command window 中 1 上 下鍵 切換到之前 之後的命令,可以重複按多次來達到你想要的命令 2 clc 清除命令視窗顯示的語句,此命令並不清空當前工作區的變數,僅僅是把螢幕上顯示出來的語句清除掉 3 clear 這個才是清空當前工作區的變數命令,常用語句clear al...

介紹幾款開發中非常好用的軟體

notepad notepad 是一款windows環境下免費開源的 編輯器,功能十分強大。winmerge 檔案比較工具,在版本之間不同的時候查詢 變化的部分,十分方便 blog backup 可以備份csdn部落格,但是匯出html網頁功能需要註冊,不過不匯出也沒事。它把 上你部落格的內容給備份...

console 非常實用的方法

是否有前端小夥伴和我一樣,一直都console.log 列印資訊 最近看到篇國外文章寫到幾種常用console的方法,超實用,希望大家看完後能夠提高開發效率。文章都會先發布在 github 上 js 原始碼 上面這些方法可以接受多個引數 2 console.group console.group 列...