下面列出了怎么用android.widget.AbsoluteLayout.LayoutParams的API类实例代码及写法,或者点击链接到github查看源代码。
public ProgressWebView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.progressbar = new ProgressBar(context, null, 16842872);
this.progressbar.setLayoutParams(new LayoutParams(-1, Util.dip2px(context, 3.0f), 0, 0));
this.progressbar.setProgressDrawable(context.getResources().getDrawable(R.drawable.webview_loading_progress_style));
addView(this.progressbar);
setWebChromeClient(new WebChromeClient(this));
}
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
LayoutParams lp = (LayoutParams) this.progressbar.getLayoutParams();
lp.x = l;
lp.y = t;
this.progressbar.setLayoutParams(lp);
super.onScrollChanged(l, t, oldl, oldt);
}