Methods Summary |
---|
private android.widget.Button | addSkinny(android.widget.LinearLayout root, java.lang.String label, boolean atRight)Add a skinny button that takes up just less than half of the screen
horizontally.
Button button = new MyButton(this);
button.setText(label);
button.setLayoutParams(new LinearLayout.LayoutParams(
0, // width
ViewGroup.LayoutParams.WRAP_CONTENT,
480));
TextView filler = new TextView(this);
filler.setText("filler");
filler.setLayoutParams(new LinearLayout.LayoutParams(
0, // width
ViewGroup.LayoutParams.WRAP_CONTENT,
520));
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.HORIZONTAL);
ll.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
if (atRight) {
ll.addView(filler);
ll.addView(button);
root.addView(ll);
} else {
ll.addView(button);
ll.addView(filler);
root.addView(ll);
}
return button;
|
public android.widget.Button | getBottomWide()
return mBottomWide;
|
public android.widget.LinearLayout | getLayout()
return mLayout;
|
public android.widget.Button | getMidSkinny1Left()
return mMidSkinny1Left;
|
public android.widget.Button | getMidSkinny2Right()
return mMidSkinny2Right;
|
public android.widget.Button | getTopWide()
return mTopWide;
|
private android.widget.Button | makeWide(java.lang.String label)
Button button = new MyButton(this);
button.setText(label);
button.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
return button;
|
protected void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
mLayout = new LinearLayout(this);
mLayout.setOrientation(LinearLayout.VERTICAL);
mLayout.setHorizontalGravity(Gravity.LEFT);
mLayout.setLayoutParams(new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
mTopWide = makeWide("top wide");
mLayout.addView(mTopWide);
mMidSkinny1Left = addSkinny(mLayout, "mid skinny 1(L)", false);
mMidSkinny2Right = addSkinny(mLayout, "mid skinny 2(R)", true);
mBottomWide = makeWide("bottom wide");
mLayout.addView(mBottomWide);
setContentView(mLayout);
|