anu*_*ika 1 user-interface android
我使用此方法创建进度对话框.
但它不适合屏幕尺寸.我想最小化此进度对话框的大小.
这是我使用的(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);
}
};
Run Code Online (Sandbox Code Playgroud)
任何人都可以帮我最小化这个进度对话框大小?
也许这有助于适应屏幕尺寸:
myPd_bar.show();
Window window = myPd_bar.getWindow();
window.setLayout(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6138 次 |
| 最近记录: |