Android Question Custom View Standard Properties setting

Cableguy

Expert
Licensed User
Hi guys...

I'm creating a simple custom view with designer support. Since the base panel is not accessible from outside the "createview" sub, I initialized a secondary BasePanel and set it to be the Base, so it can be accessible by other subs, like a setLeft and getLeft sub...
But I get an error when trying to set BasePanel, or any other of my customview views...
I think its because the layout file is not yet finished loading/creating the views so they are not yet inilialized...
So, my question is... how to implement basic props like Left, Top, Width and Height for a custom view WITH designer support so that thay can be accessible...?
 

klaus

Expert
Licensed User
I use class private variables for this purpose.
In the DesignerCreateView routine set the variables with the Base properties and then you can do what ever you want with them.
 
Upvote 0

Cableguy

Expert
Licensed User
That I understand... but I keep getting "Panel should first be initialized" errors... even if I change for another view.. like a button, I get the errors relating to the buttons.inilializing

[EDIT] I was making a very common mistake... I was re-initializing a view that was added in the designer... now it works!
 
Last edited:
Upvote 0
Top