I am writing a drag and drop application and got really confused because of some parameters.
Please help to figure out.
First of all, I read the documentation fo
You can get pixels from dp with
float ht_px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, ht, getResources().getDisplayMetrics());
float wt_px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, wt, getResources().getDisplayMetrics());
As of the positioning question.
getTop
and getLeft
are relative values and are based on your parent. Since the only parent of your ImageView
is LinearLayout
you are effectively positioning your ImageView
directly below the ActionBar
/ToolBar
Also don't use an image for a circle, you can draw it easily with canvas.drawCircle it takes much less memory.