Inflating layout to a custom View class in Java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Inflating layout to a custom View class in Java

I created a custom class that extends View class, because I need to attach relevant information to the views, but now I can't inflate their layout because the inflater wants to inflate to a View, and it's not letting me cast, I'm guessing because it's a subclass

6th Oct 2021, 9:11 PM
Michael Coster
Michael Coster - avatar
1 Answer
0
What is your issue. It is not clear from what you have written. You can inflate your view with xml layout in your customview constructor. Just use inflate method and pass necessary params.
20th Oct 2021, 2:12 PM
Rahul Kumar
Rahul Kumar - avatar