Many Android methods to set layout aspects take an INT as parameter, but the description of those methods on the Google guides and documentation show as if the arguments were strings. For instance, the setOrientation() method of a LinearLayout. Here’s the description:
public void setOrientation (int orientation)
Should the layout be a column or a row.
android:orientation
Parameters Pass HORIZONTAL or VERTICAL. Default value is HORIZONTAL.
As you can see, the method takes an INT as parameter, but the description tells me to pass either HORIZONTAL or VERTICAL.
I noticed the same pattern on many other methods, so how do I figure out what values to pass to achieve what I want?
Update: By trial and error I found that 0 represents horizontal and 1 vertical. Shouldn’t this documentation explain this more clearly, though?
It’s because those are
static final ints calledHORIZONTALandVERTICALso you would call: