使用一个已经存在的类,如果它的方法跟我们的要求不相同时,这时就应该考虑使用适配器模式。
适配器可以让客户端统一调用同一接口,这样可以更简单、更直接、更紧凑。(摘自《大话设计模式》)
适配器可以让客户端统一调用同一接口,这样可以更简单、更直接、更紧凑。(摘自《大话设计模式》)
2015-01-30
zhuang zuo jian he zhuenbeijinwanlinihaoa haha!ni hao ma?ha ha ni hao a?
2015-01-29
private interface topbarVlicklistenerP
public void leftclick();
public void rightclick();
public void setOntopbarClickliteneer();
private void setOnTOPbATCLICKLISTENER();
TOPBA TIP=FINDvIEW
TOPT
TOPSEToNTOPBARcLIKX
NEW TOPSETonpto
public void leftclick();
public void rightclick();
public void setOntopbarClickliteneer();
private void setOnTOPbATCLICKLISTENER();
TOPBA TIP=FINDvIEW
TOPT
TOPSEToNTOPBARcLIKX
NEW TOPSETonpto
2015-01-29
public interfacepublic void setOnTopbarClickListener(topbarClickLiatener listener){
2015-01-29
<TextView>
<com.imooc.app.topbar
wid th
height;
leftButton.setOnClickListener(new OnClickListener(){
public void onClick(View v ){
<com.imooc.app.topbar
wid th
height;
leftButton.setOnClickListener(new OnClickListener(){
public void onClick(View v ){
2015-01-29
private LayoutParams leftParams,rightParams,titleParams;
leftParams=new LayourParams();
leftParams.addRule(RelativeLayout.al;ture;);
addView(leftButton,leftParams);
tvtitle,titleparams;
certerinmatchpar;
leftParams=new LayourParams();
leftParams.addRule(RelativeLayout.al;ture;);
addView(leftButton,leftParams);
tvtitle,titleparams;
certerinmatchpar;
2015-01-29
leftButton=new Button(context);
rightButton=new Button(context);
tvtitle=new TextView(context);
leftButton.setTextColor(leftBackground);
leftButton.setBackground(tightBackground);
ta.recycle();
tvtltle.setTEXTcolor();
tvtitle.setTextSize(titleTextSize);
tvtitle.setGravity(Gravity.center);
setB
rightButton=new Button(context);
tvtitle=new TextView(context);
leftButton.setTextColor(leftBackground);
leftButton.setBackground(tightBackground);
ta.recycle();
tvtltle.setTEXTcolor();
tvtitle.setTextSize(titleTextSize);
tvtitle.setGravity(Gravity.center);
setB
2015-01-29
private Button leftButtons Relativelayout{
private Button leftButton,rightButton;
private
private int titleTextColor;
private String title;
private Drawable rightBackground;
public Topbar(Context context,AttribuSET
private Button leftButton,rightButton;
private
private int titleTextColor;
private String title;
private Drawable rightBackground;
public Topbar(Context context,AttribuSET
2015-01-29
ID <declare-styleable name="Topbar">
<attr name="title" >
<attr name="titleTextSize" format="dimension"/>
<attr name="title" >
<attr name="titleTextSize" format="dimension"/>
2015-01-29