Android(安卓)ProgressDialog设置透明程度
public ProgressDialog gotoDialog(Context cxt) {
MyProgressDialog dialog = new MyProgressDialog(cxt, totalPage);
dialog.setTitle("跳转");
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.setMax(totalPage);
/**设置透明度*/
Window window = dialog.getWindow();
WindowManager.LayoutParams lp = window.getAttributes();
lp.alpha = 0.7f;// 透明度
lp.dimAmount = 0.8f;// 黑暗度
window.setAttributes(lp);
int start = flipper.getDisplayedChild() + 1;
if (totalPage > 0) {
final int total = totalPage;
dialog.setIndeterminate(false);
dialog.incrementProgressBy(start * totalPage / total);
dialog
.setX(this.getWindowManager().getDefaultDisplay()
.getWidth() - 40);
dialog.setCallBack(new MyProgresDialogCallBack() {
@Override
public void callback(int scale) {
if (scale <= 0) {
scale = 1;
} else if (scale >= total) {
scale = total;
}
flipper.setDisplayedChild(scale - 1);
flipper.postInvalidate();
pageNo.setText("[" + scale + "/" + totalPage + "]");
}
});
}
return dialog;
}
更多相关文章
- 【Android】Activity全屏设置
- android 给textview部分文字设置点击事件
- android TextView文字透明度和背景透明度设置
- 设置android:elevation无效
- TextView
- 自定义View android 像支付宝支付界面的progress
- Android(安卓)Studio 初体验
- Android中的全屏
- android 横屏竖屏设置