Issue
i want to restrict webView's
limit
inside some pixels
which is have declared at the time of webView
initialization .
View insertPoint = findViewById(R.id.layout);
WebView web = new WebView(this) ;
web.setBackgroundColor(Color.GRAY);
int lHeight = 200 ;
int lWidth = 200 ;
( (ViewGroup) insertPoint ).addView(web, lWidth, lHeight) ;
web.loadUrl("http://www.google.com");
Edited :
Full Screen is taken by that WebView
, it is not residing inside 200px*200px
.
Edited :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:id="@+id/layout" >
</LinearLayout>
Solution
Your code should work if you also add the line:
web.setWebViewClient(new WebViewClient());
Otherwise your code will start the browser(which is full screen). If you click BACK for example you should see your gray box.
Answered By - user
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.