Preview custom component in designer

I have a custom component that can be placed in my layout file (XML) for an Android project. The problem is how to change the image representing it in the graphic designer for the layout. So far it has not been displayed, since it only extends the View class.

As an example, you can look at the Wheel component code, which does not have a graphical representation. It does not have to be an accurate representation, just an β€œicon” of it.

+4
source share
1 answer

Just follow the default drawing (when the adapter has a null value or does not have any elements) in the onDraw method. For example, draw an empty wheel. In my case, that was the solution.

+2
source

Source: https://habr.com/ru/post/1402474/


All Articles