編輯:關於Android編程
public class AndroidTools {
/**
* 判斷橫豎屏
* @param activity
* @return 1:豎 | 0:橫
*/
public static int ScreenOrient(Activity activity)
{
int orient = activity.getRequestedOrientation();
if(orient != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE && orient != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
WindowManager windowManager = activity.getWindowManager();
Display display = windowManager.getDefaultDisplay();
int screenWidth = display.getWidth();
int screenHeight = display.getHeight();
orient = screenWidth < screenHeight ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT : ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
}
return orient;
}
}
Android 啟動模式詳細介紹
Android 啟動模式: 啟動模式:LaunchMode在多個Activity跳轉的過程中扮演著重要的角色,它可以決定是否
Android handler 詳解(面試必問)
handler在Android中被稱為“消息處理者”,在多線程中比較常用。Handler為Android提供了一種異步消息處理機制,當向消息隊列中發送消息 (sendMe
Android性能優化之使用線程池處理異步任務
說到線程,我想大家都不陌生,因為在開發時候或多或少都會用到線程,而通常創建線程有兩種方式: 1、繼承Thread類 2、實現Runnable接口雖說這兩種方式都可以創建出
Android studio導入開源項目
前幾天從github上下載一個開源項目,發現他並不是以前Eclipse那種的目錄結構 而是最近在用到的android studio的文件目錄。從上圖中我們可以看到多次出