Mm

1 - ftM(M Button m ImageButton)M®^S©®^ ' £ Windows

2. ^m^m View fgffi^—® ' mg&mmmtt ' SPM^ r ffiM j (Layout) =

3. M^Mmm^w-' ig: rnrnm^mm ° • m^MM&mftmz&M'gftmm^ ° mm • ® ok m Exit m\mmm^

4. mk ' ffiamME LinearLayout M Cancel ' «—fi^Mft ffiM ' LinearLayout ° MTH :

yLinearLayout

// LinearLayout yLinearLayout

// LinearLayout

5. ff^ : LinearLayout layout = new LinearLayout(this);

layout. setOrientation(LinearLayout. VERTICAL);

m^—m LinearLayout ft^Sft View ffr ' MÄ^MEMffiM °

6. ImageButton btn = new ImageButton(this);

Drawable dw = this.getResources().getDrawable(R.drawable.o£);

btn. setlmageDrawable(dw); btn. setOnClickListener(listener);

ÄflA-MMA * ISA/res/drawable/ok.jpg^ftM^Hft * MMMWl °

7. fsA • LinearLayout.LayoutParams param =

new LinearLayout.LayoutParams(WC, WC);

ÄflA-ffiLayoutParams^A ' AAiEWC#m#AM^Ag '

^ffi ImageButton ^ Button f^A^PA^ layout g^—fi ■=

10. fgA • LinearLayout out_layout = new LinearLayout(this);

out_layout.setOrientation(LinearLayout.HOR7ZONTAL);

LinearLayout ft^A® out_layout ffM ' AAlSA^AASfM °

out_layout.addView(btn3, param);

ffi layout(SPAAMAP btn3 JpA^ out_layout g^—fi °

* AA—ffiffiMg ' ffifMA®A/res/layout/gft xml AAg(M$P main.xml) > ^ ^iAi^AfsA setContentView(R.layout.main)AM^ main.xml ' föÄA

* AAmftffiMg ' MA onCreate()®mg ' ESA®ÄffiftffM °

Was this article helpful?

0 0

Post a comment