Android examples for Graphics:Pixel
Resolves a dimension resource that uses density-independent pixels
//package com.book2s; import android.content.Context; import android.support.annotation.DimenRes; public class Main { /**//from w w w . j av a 2 s . c om * Resolves a dimension resource that uses density-independent pixels * * @param context the current context * @param res the dimension resource holding a DP value * @return the size in pixels */ public static float pixelsFromDpResource(Context context, @DimenRes int res) { return context.getResources().getDimension(res); } }