Android Application Development has always been a fun hobby of mine. Most recently, I got my hands on Illumination Software Creator (which, by the way, is absolutely awesome!). Wanting to get my hands dirty with playing connect-the-dots and making an Android app with practically no work, I found everything to be extremely limited as far as the internal building blocks go. And most disappointingly, it creates depreciated <AbsoluteLayout> XML by default … *Ugh!* … Wanting to get a simple LinearLayout implemented, I dived into the Custom Blocks feature, and found some relief. Since Illumination Software Creator won’t allow me to edit the XML manually, I pitched it all together and made it call a function that adds the layout elements programatically. The only problem I see with this is being able to add UI elements (like buttons, etc.) in a modular manner instead of hard-coding them into the Custom Block.
Below is the code I’m using for the Custom Block. If anyone knows a better way to do this, I’m eager to learn!
Block Name: LinearLayout
Category: Layout
Input: Open
Target: Android
Import Statements:
import android.widget.LinearLayout; import android.view.ViewGroup;
public void LinearLayout() {
LinearLayout layout = new LinearLayout(this);
layout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
Button button = new Button(this);
button.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
button.setText("my button");
layout.addView(button);
setContentView(layout);
}
