亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么點了確認按鈕不會彈出“歡迎大家支持慕課網”

package com.example.progressbar;


import android.os.Bundle;

import android.app.Activity;

import android.app.ProgressDialog;

import android.content.DialogInterface;

import android.view.Menu;

import android.view.View;

import android.view.View.OnClickListener;

import android.view.Window;

import android.widget.Button;

import android.widget.ProgressBar;

import android.widget.TextView;

import android.widget.Toast;


public class MainActivity extends Activity implements OnClickListener{

? ? private ProgressBar progressBar;

? ? private Button add;

? ? private Button jian;

? ? private Button chong;

? ? private TextView text;

? ? private ProgressDialog progressDialog;

? ? private Button show;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_PROGRESS);

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

setContentView(R.layout.zyq);

setProgressBarIndeterminate(true);

setProgressBarIndeterminateVisibility(false);

init();

}

private void init() {

// TODO Auto-generated method stub

progressBar=(ProgressBar) findViewById(R.id.hon);

add=(Button) findViewById(R.id.add);

jian=(Button) findViewById(R.id.jian);

chong=(Button) findViewById(R.id.chong);

text=(TextView) findViewById(R.id.text);

show=(Button) findViewById(R.id.show);

show.setOnClickListener(this);

int first = progressBar.getProgress();

int second = progressBar.getSecondaryProgress();

int max = progressBar.getMax();

text.setText("第一進度:"+(int)(first/(float)max*100)+"% 第二進度:"+(int)(second/(float)max*100)+"%");

? ?add.setOnClickListener(this);

? ?jian.setOnClickListener(this);

? ?chong.setOnClickListener(this);

}

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

switch (v.getId()) {

case R.id.add:{

progressBar.incrementProgressBy(5);

progressBar.incrementSecondaryProgressBy(5);

break;

}

case R.id.jian:{

progressBar.incrementProgressBy(-5);

progressBar.incrementSecondaryProgressBy(-5);

break;

}

case R.id.chong:{

progressBar.setProgress(50);

progressBar.setSecondaryProgress(80);

break;

}

case R.id.show:{

progressDialog=new ProgressDialog(MainActivity.this );

progressDialog.setProgressStyle(progressDialog.STYLE_HORIZONTAL);

progressDialog.setTitle("慕課網");

progressDialog.setMessage("歡迎大家支持慕課網");

progressDialog.setIcon(R.drawable.ic_launcher);

progressDialog.setMax(100);

progressDialog.incrementProgressBy(60);

progressDialog.setIndeterminate(false);

progressDialog.setButton(progressDialog.BUTTON_POSITIVE, "確認", new DialogInterface.OnClickListener() {

@Override

public void onClick(DialogInterface dialog, int which) {

// TODO Auto-generated method stub

Toast.makeText(MainActivity.this, "歡迎大家支持慕課網", Toast.LENGTH_SHORT);

}

});

progressDialog.setCancelable(true);

progressDialog.show();

break;

}

?}

text.setText("第一進度:"+(int)(progressBar.getProgress()/(float)progressBar.getMax()*100)+"% 第二進度:"+(int)(progressBar.getSecondaryProgress()/(float)progressBar.getMax()*100)+"%");

}

}


正在回答

2 回答

把Toast.makeText(MainActivity.this, "歡迎大家支持慕課網", Toast.LENGTH_SHORT);

Toast.makeText(MainActivity.this, "歡迎大家支持慕課網", Toast.LENGTH_SHORT).show();

1 回復 有任何疑惑可以回復我~
#1

噗通_ 提問者

非常感謝!
2016-10-22 回復 有任何疑惑可以回復我~

贊同以上說法

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
Android攻城獅的第二門課(第1季)
  • 參與學習       111145    人
  • 解答問題       1560    個

本課程由淺入深地帶您學會Android的常用控件的開發和使用

進入課程

為什么點了確認按鈕不會彈出“歡迎大家支持慕課網”

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號