I am writing a custom component in HarmonyOS using Java SDK.
I am trying to convert vp to Px.
In Android we can convert dp to px using below code.
TypedValue.applyDimension(
int unit,
float value,
android.util.DisplayMetrics metrics)
I tried the following code for HarmonyOS but not working.
TypedAttribute.computeTranslateRatio(DeviceCapability devCap)
Try method AttrHelper.vp2px
. doc: https://developer.harmonyos.com/cn/docs/documentation/doc-references/attrhelper-0000001054518726