Reputation: 473
Layout editor doesn't display a custom view when I use a custom font. However, it works when I run the app.
When I write the line that assigns a typeface it doesn't display the view.
textValuePaint = TextPaint().apply {
textSize = DimensionsUtils.dpToPx(context, 24f)
typeface = ResourcesCompat.getFont(context, R.font.alex_brush)
}
It also says Path.op() not supported. I don't know if that is related with my problem.
Can someone help me?
Upvotes: 0
Views: 245
Reputation: 763
Some operations are not supported in the edit mode so you cannot see them in preview. In order to overcome this, you should run this kind of operations only in runtime. To achieve this you can use isInEditMode() method in your custom view. For example
if(!isInEditMode()){
typeface = ResourcesCompat.getFont(context, R.font.alex_brush)
}
Upvotes: 1