我使用这种方法来创建进度对话框。
但它不适合屏幕尺寸。我想最小化这个进度对话框的大小。
这是我使用的(AsyncTask)代码:
ProgressDialog myPd_bar;
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
myPd_bar=new ProgressDialog(AppleModles.this);
//myPd_bar.setMessage("Loading....");
myPd_bar.setTitle("Please Wait..");
myPd_bar.setProgressStyle(myPd_bar.STYLE_HORIZONTAL);
myPd_bar.setProgress(0);
myPd_bar.setMax(30);
myPd_bar.show();
new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
try
{
while(myPd_bar.getProgress()<=myPd_bar.getMax())
{
Thread.sleep(1000);
handle.sendMessage(handle.obtainMessage());
if(myPd_bar.getProgress()==myPd_bar.getMax())
{
myPd_bar.dismiss();
}
}
}catch(Exception e){}
}
}).start();
super.onPreExecute();
}
Handler handle=new Handler(){
@Override
public void handleMessage(Message msg) {
// TODO Auto-generated method stub
super.handleMessage(msg);
myPd_bar.incrementProgressBy(5);
}
};
谁能帮我最小化这个进度对话框的大小?