第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

正在回答

3 回答

@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if( v == imagebutton1 ){
setContentView(R.layout.firsttitle);
}else if( v == imagebutton2){
setContentView(R.layout.stationaround);
}else if( v == imagebutton3){
setContentView(R.layout.transferbus);
}
}

這里判斷時(shí)使用switch判斷id,跳轉(zhuǎn)時(shí)使用Intent和startAvtivity()


0 回復(fù) 有任何疑惑可以回復(fù)我~

哪里不對(duì)

0 回復(fù) 有任何疑惑可以回復(fù)我~

1

public class MainActivity extends Activity implements OnClickListener{

    private ImageButton imagebutton1,imagebutton2;

    private ImageButton imagebutton3,imagebutton4;

    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);

        setContentView(R.layout.firsttitle);

//        查找,周邊站點(diǎn),換乘,更多的ImageButton

        imagebutton1 = (ImageButton) findViewById(R.id.fristtitle_leftBtn);

        imagebutton2 = (ImageButton) findViewById(R.id.fristtitle_leftBtn2);

        imagebutton3 = (ImageButton) findViewById(R.id.fristtitle_rightBtn2);

        imagebutton4 = (ImageButton) findViewById(R.id.fristtitle_rightBtn);

        imagebutton1.setOnClickListener(this);

        imagebutton2.setOnClickListener(this);

        imagebutton3.setOnClickListener(this);

        imagebutton4.setOnClickListener(this);

    }



    @Override

    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.

        getMenuInflater().inflate(R.menu.main, menu);

        return true;

    }



@Override

public void onClick(View v) {

// TODO Auto-generated method stub

if( v == imagebutton1 ){

setContentView(R.layout.firsttitle);

}else if( v == imagebutton2){

setContentView(R.layout.stationaround);

}else if( v == imagebutton3){

setContentView(R.layout.transferbus);

}

}

    

}

2

public class TransferBus extends Activity{

private ImageButton Ibt1,Ibt2;

private Context mContext;

    @Override

    protected void onCreate(Bundle savedInstanceState) {

    // TODO Auto-generated method stub

    super.onCreate(savedInstanceState);

    setContentView(R.layout.transferbus);

    mContext = this;

        Ibt1 = (ImageButton) findViewById(R.id.fristtitle_leftBtn);

        Ibt2 = (ImageButton) findViewById(R.id.fristtitle_leftBtn2);

//        Ibt3 = (ImageButton) findViewById(R.id.fristtitle_rightBtn2);

//        Ibt4 = (ImageButton) findViewById(R.id.fristtitle_rightBtn);

        Ibt1.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

Intent intnet = new Intent(mContext,MainActivity.class);

}

});

        Ibt2.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

Intent intnet = new Intent(mContext,StationAround.class);

}

});

    }

}


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Android攻城獅的第一門課(入門篇)
  • 參與學(xué)習(xí)       312506    人
  • 解答問題       4931    個(gè)

想快速掌握Android應(yīng)用開發(fā)基礎(chǔ),選擇學(xué)習(xí)這門課程就對(duì)了。

進(jìn)入課程
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)