6

I have class (MyCustomWebView) that extend webview can i do something like this ?

<MyCustomWebView 
    android:id="@+id/myCustomWebView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
/>

if not, could i do something like this.

WebView webView = (WebView) findViewById(R.id.webview);
webView = new MyCustomWebView(this);

1 Answer 1

16

Yes, you can do this:

    <your.package.MyCustomWebView android:id="@+id/myCustomWebView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    />

Then in code you can do this:

MyCustomWebView myWebView = (MyCustomWebView) findViewById(R.id.myCustomWebView);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.