Android音乐播放器(二)登录注册界面
生活随笔
收集整理的這篇文章主要介紹了
Android音乐播放器(二)登录注册界面
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
這是去年大二做的一個簡單音樂播放器項目:是盡可能模仿酷狗音樂寫的,具體實現的功能如下:
1:啟動動畫:點擊運行程序會出現一個兩秒鐘的視頻,類似酷狗音樂的啟動動畫一樣,非常可觀!
2:登錄注冊界面:輸入賬號和密碼檢驗信息登錄!
3:輪播圖:和酷狗音樂的一模一樣,在主界面的上方有一個自動循環的輪播圖,點擊輪播圖的每一個圖片信息即可進入對應的具體服務,非常具有加分點!
4:音樂唱片的轉盤,歌曲同步進度條,以及音樂的暫停/播放/繼續/上下曲切換!
5:音樂的搜索實現!
6:視頻專欄的播放!
7;個人信息界面的布局實現,如反饋,評分,更多,性別年齡昵稱,收藏等!
登錄注冊界面代碼如下:
package com.ypc.xiaoxiongmusic; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.View.OnClickListener; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Toast;import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; public class LoginActivity extends AppCompatActivity{Button button;EditText edit1,edit2;CheckBox checkbox;ProgressBar bar;SharedPreferences pref;SharedPreferences.Editor editor;@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_login);button=(Button) findViewById(R.id.login_button);edit1=(EditText) findViewById(R.id.input1);edit2=(EditText) findViewById(R.id.input2);checkbox=(CheckBox) findViewById(R.id.remember_button);bar=(ProgressBar) findViewById(R.id.progress);pref= PreferenceManager.getDefaultSharedPreferences(this);boolean isRemember=pref.getBoolean("rem",false); //用于給是否保存密碼賦值if(isRemember) { //將賬號和密碼設置到文本框中String account=pref.getString("account","");String password=pref.getString("password","");edit1.setText(account);edit2.setText(password);checkbox.setChecked(true);}button.setOnClickListener(new OnClickListener() {@Overridepublic void onClick(View view) {String account=edit1.getText().toString();String password=edit2.getText().toString();if(account.equals("zxr") && password.equals("xbt")) {editor = pref.edit();if(checkbox.isChecked()) {editor.putBoolean("rem",true);editor.putString("account",account);editor.putString("password",password);}else {editor.clear();}editor.commit();AlertDialog.Builder builder=new AlertDialog.Builder(LoginActivity.this);builder.setTitle("XiaoXiongMusic");builder.setMessage("該APP致力于為用戶帶來精選的音樂服務,該軟件內所有的音樂皆經過本人授權,嚴禁用戶使用APP內的音樂,視頻等資源進行非法牟利,用戶必須遵守軟件協議,最終解釋權歸DY.memory所有!"); builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {Intent intent = new Intent(Intent.ACTION_MAIN);intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.addCategory(Intent.CATEGORY_HOME);startActivity(intent);System.exit(0);} }); builder.setPositiveButton("agree", new DialogInterface.OnClickListener() {@Overridepublic void onClick(DialogInterface dialog, int which) {Intent intent=new Intent(LoginActivity.this,MainInterfaceActivity.class);startActivity(intent);} });builder.create().show();}else{Toast.makeText(LoginActivity.this,"賬號或用戶名錯誤",Toast.LENGTH_SHORT).show();}}});} }效果截圖如下:
?
?
總結
以上是生活随笔為你收集整理的Android音乐播放器(二)登录注册界面的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java计算机毕业设计高校共享单车管理系
- 下一篇: android音乐播放器ppt,基于An