Alex
Alex

Reputation: 2037

How replace webView by custom webView?

I has my activity that contain only one webView.

Activity write on Kotlin:

    class MyActivity : AppCompatActivity() {

        @SuppressLint("NewApi")
        override fun onCreate(savedInstanceState: Bundle?) {
           // some code here
            verticalLayout {
                webView {//replace this by custom webView (ObservableWebView)
                    setOnLongClickListener(object : View.OnLongClickListener {
                        override fun onLongClick(v: View): Boolean {
                            return true
                        }
                    })
                }
            }
       }
    }

Also I has custom webView - ObservableWebView.java:

public class ObservableWebView extends WebView {
 // some code here
}

I want to replace webView with my custom webView (ObservableWebView) in class MyActivity.kt. How I can do this?

Upvotes: 0

Views: 1750

Answers (1)

Logain
Logain

Reputation: 4374

If you want to add your custom webview following anko syntax, you need to extend the DSL as stated on the docs

Follow the MapView example but use your ObservableWebView instead.

Upvotes: 1

Related Questions