I am working on poster maker application so I having photoshop template and trying to set exact same design in my android device through dynamic coding which look like photoshop template , I have that design in parts like images of that design ,texts of that design is different part so user can rearrange it, My Question : I have that design parts x axis ,y axis in px and I have to set in dp, I tried to convert x and y axis px value to dp value,
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
int brandx = Math.round(51.189f * (displayMetrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT)); int brandy = Math.round(27.985f * (displayMetrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT));
For set one image part through above code but it not came on position,
Help me out on this.
Thanks.