2011-12-22 8 views
5

WebViewを拡張するクラス(MyCustomWebView)があります。このようなことができますか?AndroidでカスタムWebviewを作成するには?

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

もしそうでなければ、私はこのようなことをすることができます。

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

答えて

15

はい、あなたはこれを行うことができます。

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

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

は、その後のコードで、あなたがこれを行うことができます

関連する問題