小编A.E*_*sam的帖子

如何使用 kotlin 将按钮与 android studio 中的网站链接

我想将我的应用程序中的按钮与网站链接,因为当用户单击此按钮时,网站会在浏览器或应用程序中打开,我使用的是 kotlin 而不是 java,我该怎么做?:) 我尝试使用此代码:

bu1.setOnClickListener({
var gourl= Intent(this,Uri.parse("https://www.facebook.com/"))
startActivity(gourl)
})


 bu1.setOnClickListener({
var gourl= Intent(this,Uri.parse("https://www.facebook.com/"))
startActivity(gourl)
})

 bu1.setOnClickListener({
var gourl= Intent(this,Uri.parse("https://www.facebook.com/"))
startActivity(gourl)
})
Run Code Online (Sandbox Code Playgroud)

android uri android-intent kotlin

6
推荐指数
1
解决办法
8316
查看次数

标签 统计

android ×1

android-intent ×1

kotlin ×1

uri ×1