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

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

在做progressbar練習(xí)時(shí),程序都沒錯(cuò),可無法運(yùn)行?如圖

http://img1.sycdn.imooc.com//5817237e0001359c08160839.jpg

請(qǐng)問出現(xiàn)類似代碼沒錯(cuò)但是無法運(yùn)行的情況如何自己找錯(cuò)?

正在回答

2 回答

package com.example.progressbar;

import android.os.Bundle;

import android.app.Activity;

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;


public class MainActivity extends Activity implements OnClickListener{

? ? private ProgressBar progressbar4;

? ? private Button add;

? ? private Button reduce;

? ? private Button reset;

? ? private TextView textView1;

? ? @Override

? ? protected void onCreate(Bundle savedInstanceState) {

? ? ? ? super.onCreate(savedInstanceState);

? ? ? ? setContentView(R.layout.activity_main);

// ? ? ?啟用串口特征,啟用帶進(jìn)度的和不帶進(jìn)度

? ? ? ? requestWindowFeature(Window.FEATURE_PROGRESS);

? ? ? ? requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

// ? ? ?顯示兩種進(jìn)度

? ? ? ? setProgressBarVisibility(true);

? ? ? ? setProgressBarIndeterminateVisibility(true);

? ? ? ? setProgress(800);

? ? ? ? init();

? ? }

? ? ? ? private void init() {

// TODO Auto-generated method stub

progressbar4=(ProgressBar) findViewById(R.id.progressBar4);

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

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

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

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

// 獲取第一和第二條進(jìn)度條

int first=progressbar4.getProgress();

int second=progressbar4.getSecondaryProgress();

// 獲進(jìn)度條最大進(jìn)度

int max=progressbar4.getMax();

textView1.setText("第一進(jìn)度百分比"+(int)(first/(float)max*100)+"% 第二進(jìn)度百分比"+(int)(second/(float)max*100)+"%");

add.setOnClickListener(this);

reduce.setOnClickListener(this);

reset.setOnClickListener(this);

? ? ? ??

? ? ? ? }

@Override

public void onClick(View v) {

// TODO Auto-generated method stub

switch (v.getId()){

case R.id.add:{

// 增加第一第二進(jìn)度條10個(gè)刻度

progressbar4.incrementProgressBy(10);

progressbar4.incrementSecondaryProgressBy(10);

break;}

case R.id.reduce:{

// 減少第一第二進(jìn)度條10個(gè)刻度

progressbar4.incrementProgressBy(-10);

progressbar4.incrementSecondaryProgressBy(-10);

break;}

case R.id.reset:{

progressbar4.setProgress(50);

progressbar4.setSecondaryProgress(80);

break;}

}

}

? ??

}


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

出現(xiàn)這個(gè)結(jié)果,都是控件沒初始化,或者xml文件里面名字寫錯(cuò)了。錯(cuò)誤應(yīng)該比較好找的。

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

Am_Mr_Right 提問者

初始化了,名字也查了都沒錯(cuò)。。~ ~。。,還是無法運(yùn)行 如下圖
2016-10-31 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

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

本課程由淺入深地帶您學(xué)會(huì)Android的常用控件的開發(fā)和使用

進(jìn)入課程

在做progressbar練習(xí)時(shí),程序都沒錯(cuò),可無法運(yùn)行?如圖

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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