Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

108
Vistas
Cómo eliminar la sección no deseada en Kotlin Webview Android Studio

Estoy convirtiendo mi sitio web de wordpress en una aplicación de Android usando webview en kotlin, y quiero eliminar (ocultar) el encabezado del sitio web en la versión de la aplicación, probé muchas búsquedas y encontré una manera de hacerlo inyectando javascript en el
función onpagefinish, pero no funcionó, este es mi código con las opciones que he probado

 **val v: View = inflater.inflate(R.layout.fragment_home, container, false)
 val webView = v.findViewById<View>(R.id.webview) as WebView
 webView.webViewClient = object : WebViewClient() {
 override fun onPageFinished(view: WebView?, url: String?) {

 // the first code i try for hiding the header
 // webView.loadUrl("javascript:(function() { var a= document.getElementsByTagName('menu-pusher');a[0].hidden='true';a=document.getElementsByClassName('menu-pusher');a[0].style.padding='0px';})()")

 // the second code i try for hiding the header
 // webView.loadUrl("javascript:if (typeof(document.getElementsByClassName('menu-pusher')[0]) != 'undefined' && document.getElementsByClassName('menu-pusher')[0] != null){document.getElementsByClassName('menu-pusher')[0].style.display = 'none';} void 0");

 /* The Third Code i have try for hiding the header
 webView.loadUrl("javascript:(function() { " +
 "var head = document.getElementsByClassName('menu-pusher')[0].style.display='none'; " +
 "})()");*/

 //The Last Code i have try
 webView.loadUrl("javascript:document.getElementsByClassName('menu-pusher')[0].style.display='none'");
 }
 }
 //the webpage i am trying to load and hide the header

 webView.loadUrl("https://sadeeqtech.com.ng/stech")
 return v
 }
}

Pero por favor, chicos, si hay otra manera mejor de convertir mi sitio web de wordpress en una aplicación de Android a partir de la vue web, ayúdenme con eso pero usando kotlin

almost 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda