0

I'm dynamically creating a drawable shape in my list view and i'm setting the corner radius with this line of code.

setCornerRadius(float radius)

Am i able to specify this with a dp value somehow??

Mazz
  • 257
  • 1
  • 3
  • 17

1 Answers1

2

You're looking to get dip values dynamically? This describes it:

What is the correct way to specify dimensions in DIP from Java code?

Copied from there:

int value = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 
                     (float) 123.4, getResources().getDisplayMetrics());
Community
  • 1
  • 1
Kevin Galligan
  • 16,159
  • 5
  • 42
  • 62