до сих пор я все еще не могу отобразить индикатор выполнения в блоке навигации веб-просмотра. Я буду очень благодарен за ответы, это MainActivity:
class MainActivity: AppCompatActivity(), NavigationView.OnNavigationItemSelectedListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
setSupportActionBar(toolbar)
val toggle = ActionBarDrawerToggle(
this, drawer_layout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close)
drawer_layout.addDrawerListener(toggle)
toggle.syncState()
nav_view.setNavigationItemSelectedListener(this)
displayScreen(-1) }
override fun onBackPressed() {
if (drawer_layout.isDrawerOpen(GravityCompat.START))
{ drawer_layout.closeDrawer(GravityCompat.START) }
else { super.onBackPressed() }
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
// Inflate the menu; this adds items to the action bar if it is present.
menuInflater.inflate(R.menu.main, menu)
return true
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.action_settings -> return true
else -> return super.onOptionsItemSelected(item) }
}
fun displayScreen (id: Int){
val fragment = when (id){
R.id.nav_home -> { Home () }
R.id.nav_login -> { login0 () }
else -> { Home () }
}
supportFragmentManager.beginTransaction()
.replace(R.id.relativelayout, fragment)
.commit() }
override fun onNavigationItemSelected(item: MenuItem): Boolean {
displayScreen(item.itemId)
drawer_layout.closeDrawer(GravityCompat.START)
return true }
}
иthis home.kt aka Home: фрагмент () =
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View?
{ val view: View = inflater!!.inflate(R.layout.home, container,
false)
val myWebView: WebView = view.findViewById(R.id.webview) as WebView
myWebView.loadUrl("http://www.example.com/")
myWebView.webViewClient = WebViewClient()
(WebViewClient())
return view }