android自定义环形进度条怎么自由控制进度条的消失与隐藏
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_bluetoothmeter);
mhandler = new Handler();
//通过mSearcheHandler更新UI
mSearchHandler=new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(msg.what==0){
//改变环形进度条的进度
mCircleProcessBar.setProgress(mcnt);
mcnt+=1;
if(MCNT_MAX<=mcnt){
mCircleProcessBar.setVisibility(View.GONE);
}
}
}
};
mBlueService = BluetoothLeService.getInstance();
initView();
initEvent();
}
private void initEvent()
{
mImgBtnBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
//搜索
mbtnSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Prepare list view and initiate scanning
if (m_devicelistadapter != null) {
m_devicelistadapter.clear();
m_devicelistadapter.notifyDataSetChanged();
}
startScan();
//设置圆环进度条的出现时间(秒)
new TimerDelay(mSearchHandler).setDelayTime(CIRCLE_APPARE_TIME,mCircleProcessBar);
mcnt=1;
}
});
}