Reputation: 5980
I know that dip is standard for determining sizes on android. So when the documentation says "pixels" (for example in the Position segment of this page), does it literally mean pixels or density independent pixels?
Upvotes: 0
Views: 60
Reputation: 3305
Of course it's just pixel, not dp, but you always can convert it like that :
public static float convertDpToPixel(float dp,Context context){
Resources resources = context.getResources();
DisplayMetrics metrics = resources.getDisplayMetrics();
float px = dp * (metrics.densityDpi/160f);
return px;
}
Upvotes: 1