这是去年大二做的一个简单音乐播放器项目:是尽可能模仿酷狗音乐写的,具体实现的功能如下:
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;
@Override
protected 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() {
@Override
public 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() {
@Override
public 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() {
@Override
public 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音乐播放器(二)登录注册界面的全部内容,更多相关Android音乐播放器(二)登录注册界面内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复