【问题标题】:How do I make a button take me to a website in Android Studio? [duplicate]如何让按钮将我带到 Android Studio 中的网站? [复制]
【发布时间】:2016-06-13 08:27:10
【问题描述】:

我正在学习如何编码,但我不知道如何在 Android Studio 中制作一个按钮,将我带到网站。以及如何使按钮反向播放音频。

【问题讨论】:

标签: android


【解决方案1】:

网页部分很简单:

public void launchAbout(View view){
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://dpoisn.com/demos/AndroidDev/"));
        startActivity(browserIntent);
    }

该功能会做到这一点。这会将默认浏览器启动到您指定的任何页面。

当然你需要一个按钮来调用函数:

<Button
        android:id="@+id/buttonAbout"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:onClick="launchAbout"
        android:text="About" />

关于倒车的那一点,我得去找别人了。

【讨论】:

  • 所有这些我都会放在我的主要活动或我的 content_main.xml
  • Java 进入活动。按钮进入 xml。
猜你喜欢
  • 1970-01-01
  • 2012-09-22
  • 2018-01-14
  • 1970-01-01
  • 1970-01-01
  • 2012-08-02
  • 2022-01-21
  • 2018-08-08
  • 2012-08-06
相关资源
最近更新 更多