2016-03-01 102 views
-1

我正在学习如何编写代码,并且我不知道如何在Android Studio中创建按钮将我带到网站。我怎样才能让一个按钮反向播放音频。如何制作按钮带我进入Android Studio中的网站?

+0

http://stackoverflow.com/a/5026626/5182321 –

+0

我认为你应该把它分成两个问题(第一个用于按钮转到webview,第二个用于播放音频) – GiapLee

+0

http://www.tutorialspoint.com /android/android_mediaplayer.htm:chk音频部分 –

回答

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" /> 

关于反向音频位,我将不得不离开别人。

+0

所有这些我都会放在我的主要活动或我的content_main.xml中 – Angryman

+0

Java正在进行该活动。该按钮进入xml。 – durbnpoisn

相关问题