@SuppressLint("SetJavaScriptEnabled") private void init(Context context) { // 顶部显示的进度条 mProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal); mProgressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 7, 0, 0)); Drawable drawable = context.getResources().getDrawable(R.drawable.layer_web_progress_bar); mProgressBar.setProgressDrawable(drawable); addView(mProgressBar); WebSettings webSettings = this.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setSupportZoom(true); // 是能放大缩小 webSettings.setUseWideViewPort(true); webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); webSettings.setLoadWithOverviewMode(true); webSettings.setBuiltInZoomControls(true); webSettings.setDisplayZoomControls(false);//隐藏 webSettings.setDomStorageEnabled(true); webSettings.setSupportMultipleWindows(true); //webSettings.setUseWideViewPort(true); this.setWebViewClient(mWebViewClientBase); this.setWebChromeClient(mWebChromeClientBase); setDownloadListener(new DownloadListener()); this.onResume(); }
x ++; cell.setText(gig.getTitle()); AbsoluteLayout.LayoutParams lp = new AbsoluteLayout.LayoutParams(w, h - 1, posx, y * h); schedCont.addView(cell, lp);
AbsoluteLayout.LayoutParams layout = new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.FILL_PARENT, AbsoluteLayout.LayoutParams.FILL_PARENT, 0, 0); view.addView(laInflater.inflate(id, null), layout);
AbsoluteLayout.LayoutParams layout =new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.FILL_PARENT, AbsoluteLayout.LayoutParams.FILL_PARENT, 0, 0); group.addView(frame,layout);
private void init(Context context) { progressbar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal); progressbar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 5, 0, 0)); addView(progressbar); setWebChromeClient(new WebChromeClient());
.into(webVieo.thumbImageView); ViewGroup.LayoutParams ll = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(ll); layoutParams.y = JCUtils.dip2px(WebViewActivity.this, top); layoutParams.x = JCUtils.dip2px(WebViewActivity.this, left); .into(webVieo.thumbImageView); ViewGroup.LayoutParams ll = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(ll); layoutParams.y = JCUtils.dip2px(WebViewActivity.this, top); layoutParams.x = JCUtils.dip2px(WebViewActivity.this, left);
@SuppressLint("SetJavaScriptEnabled") private void init() { progressbar = new ProgressBar(getContext(), null, android.R.attr.progressBarStyleHorizontal); progressbar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 20, 0, 0)); addView(progressbar); WebSettings settings = getSettings(); settings.setJavaScriptEnabled(true); settings.setBuiltInZoomControls(false); settings.setCacheMode(WebSettings.LOAD_NO_CACHE); settings.setDomStorageEnabled(true); settings.setAppCacheEnabled(false); setWebChromeClient( new WebChromeClient() { @Override public void onProgressChanged(WebView view, int newProgress) { super.onProgressChanged(view, newProgress); newProgressBar(newProgress); } }); }
public ProgressWebView(Context context) { super(context); mContext = context; progressbar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal); progressbar.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 5, 0, 0)); progressbar.setProgressDrawable(context.getResources().getDrawable(R.drawable.progress_bar)); addView(progressbar); //设置 缓存模式 getSettings().setCacheMode(WebSettings.LOAD_DEFAULT); // 开启 DOM storage API 功能 getSettings().setDomStorageEnabled(true); setVerticalScrollBarEnabled(false); setHorizontalScrollBarEnabled(false); getSettings().setJavaScriptEnabled(true); setWebChromeClient(new WebChromeClient()); setWebViewClient(new MyWebViewClient()); }
public void create(Context context){ mLightView = new TextView[mLightNum]; mOutLightView = new TextView[mLightNum]; mLightParams = new AbsoluteLayout.LayoutParams[mLightNum]; this.context = context; viewsWraper = new AbsoluteLayout(context); res = context.getResources(); for (int i = 0; i < mLightNum; ++i) { mLightView[i] = addButton(mLightBackground[i]); mOutLightView[i] = addButton(mOutLightBackground[i]); mLightParams[i] = new AbsoluteLayout.LayoutParams(0,0,0,0); viewsWraper.addView(mLightView[i],mLightParams[i]); viewsWraper.addView(mOutLightView[i],mLightParams[i]); } addToWindow(); }
TextView textView = (TextView) findViewById(R.id.display); textView.setLayoutParams(new AbsoluteLayout.LayoutParams(100,40, 100, 70));
public ProgressWebView(Context context, AttributeSet attrs) { super(context, attrs); progressbar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal); progressbar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 10, 0, 0)); Drawable drawable = context.getDrawable(R.drawable.progress_bar_states); progressbar.setProgressDrawable(drawable); addView(progressbar); setWebChromeClient(new WebChromeClient()); //是否可以缩放 getSettings().setSupportZoom(true); getSettings().setBuiltInZoomControls(true); }
int width = 100, height =50, x = 10, y = 20; Button button = new Button(this); AbsoluteLayout myLayout = (AbsoluteLayout)findViewById(R.id.myLayout); myLayout.add(button, new AbsoluteLayout.LayoutParams(width, height, x, y));
public void onViewCreated () { AbsoluteLayout alo = (AbsoluteLayout) this.findViewById(R.id.container); TextView Tv = new Textview(this.getActivity()); Tv.setLayoutParams(new AbsoluteLayout.LayoutParams(10,10,40,40)); Tv.setText("Added"); alo.addView((View)Tv); }
private void init(final Context context) { for (ViewDumper.ViewItem item : list) { TextView tv = new TextView(context); tv.setTag(item); //红框 GradientDrawable redBounds = new GradientDrawable(); redBounds.setStroke(2, Color.RED); redBounds.setColor(Color.TRANSPARENT); tv.setBackgroundDrawable(redBounds); AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(item.wh.x, item.wh.y, item.bounds.x, item.bounds.y - getStatusBarHeight()); absoluteLayout.addView(tv, layoutParams); } }
@Override protected Object getObject(){ return new AbsoluteLayout.LayoutParams(0, 0, 0, 0); } }
super(context, attrs); whiteView = new WhiteSurfaceView(context); whiteView.setLayoutParams(new AbsoluteLayout.LayoutParams(800, 480, 0, 0)); addView(whiteView);
.into(webVieo.thumbImageView); ViewGroup.LayoutParams ll = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(ll); layoutParams.y = JZUtils.dip2px(ActivityWebView.this, top); layoutParams.x = JZUtils.dip2px(ActivityWebView.this, left); .into(webVieo.thumbImageView); ViewGroup.LayoutParams ll = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); AbsoluteLayout.LayoutParams layoutParams = new AbsoluteLayout.LayoutParams(ll); layoutParams.y = JZUtils.dip2px(ActivityWebView.this, top); layoutParams.x = JZUtils.dip2px(ActivityWebView.this, left);
public ProgressWebView(Context context, AttributeSet attrs) { super(context, attrs); mProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal); mProgressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 8, 0, 0)); Drawable drawable = context.getResources().getDrawable(R.drawable.progressbar_webview); mProgressBar.setProgressDrawable(drawable); addView(mProgressBar); setWebChromeClient(new WebChromeClient()); //是否可以缩放 getSettings().setSupportZoom(true); getSettings().setBuiltInZoomControls(true); }