編輯:關於Android編程
package com.lengxiaocai.myutil.screentool;
import android.content.Context;
/**
*
* @ClassName: ScreenTool
*
* @Description: 屏幕像素檢測
*
* @author yazhizhao
*
* @date 2014-5-6 上午11:47:07
*/
public class ScreenTool {
public static int dip2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
public static int px2dip(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
public static int px2sp(float pxValue, float fontScale) {
return (int) (pxValue / fontScale + 0.5f);
}
public static int sp2px(float spValue, float fontScale) {
return (int) (spValue * fontScale + 0.5f);
}
}
android L Palette 實現原理
有時候,看到一些界面上的色彩,心情可能會很舒暢,有時候,看到一些其他色彩,就覺得很討厭,不爽,看到android L Palette 從圖片中提取篩選出來的顏色,覺得都挺
Android UI組件進階(1)——帶進度條的按鈕
Android UI組件進階(1)——帶進度條的按鈕 本節引言: 這個系列是繼Android UI組件實例大全後的進階
關於Service的總結
Service是什麼 它是android App的四大組件之一,在開發中我們有時需要做一些耗時的但不需要與用戶建立界面交互的操作可以考慮使用service。比如:比如我
android系統自帶actionbar總結
android不同的版本引入的actionbar有差異,現總結如下一、在support.v7包中引入布局使用onCreateOptionsMenu方法中的參數:infla
服務器基於PHP CodeIgniter,Android基於Volley實現多文件/圖片上傳(含服務器,web版和android客戶端完整代碼)
問題背景:app在上傳圖片時,同時傳遞參數,支持傳遞多個圖片。本文中的環