2016-03-01 99 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

相關問題