2011-12-22 13 views
5

Tengo una clase (MyCustomWebView) que extienda la vista web ¿puedo hacer algo como esto?¿Cómo crear una vista web personalizada en Android?

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

si no, ¿podría hacer algo como esto?

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

Respuesta

15

Sí, usted puede hacer esto:

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

Luego, en código que puede hacer esto:

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