Java Question Creating advanced button properties in code, not designer.

Larry McQuerrey

New Member
Licensed User
There are many button properties that appear in the designer that do not appear when creating a button in code. How can I make those properties available with code?
 

Troberg

Well-Known Member
Licensed User
Those properties are mostly part of some object that, in turn, is a property. For example, CornerRadius is a property of the Drawable.

However, some properties available in the designer scripts are not available elsewhere (Right, Bottom, HorizontalCenter(?), VerticalCenter(?) and so on). That's a Little sad, as they are quite useful. Sure, they are easy to produce from Left and Width et cetera, but for pure code readaility, I would very much prefer if they were available in code as well. Once you start moving things around in code, you tend to get long lines, which would be much neater if those properties existed.
 

Larry McQuerrey

New Member
Licensed User
Thank you Troberg. It appears as you can read past a typo in the product name. Manfred must have been an English teach in his last life.

Larry
 

Erel

Administrator
Staff member
Licensed User
However, some properties available in the designer scripts are not available elsewhere (Right, Bottom, HorizontalCenter(?), VerticalCenter(?) and so on). That's a Little sad, as they are quite useful. Sure, they are easy to produce from Left and Width et cetera, but for pure code readaility, I would very much prefer if they were available in code as well. Once you start moving things around in code, you tend to get long lines, which would be much neater if those properties existed.
The anchors feature as well as the designer scripts, are based on the visual designer engine. So they can only be used when the layout file is loaded.
 

Troberg

Well-Known Member
Licensed User
Would it be possible to extend the views with those properties in code as well? It would, of course, be two different implementations under the hood, but, on the outside, they would look the same.

Now, I'm not talking about anchors, just the Right, Bottom and Center.
 
Top