main
蒋婷湘 8 months ago
parent 2a60cff2cc
commit 75c9bc4c04

@ -2,6 +2,9 @@
<project version="4">
<component name="deploymentTargetDropDown">
<value>
<entry key="MainActivity3">
<State />
</entry>
<entry key="app">
<State />
</entry>

@ -4,9 +4,7 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$PROJECT_DIR$/../../gradle-8.4-bin/gradle-8.4" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>

@ -7,4 +7,11 @@
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="VisualizationToolProject">
<option name="state">
<ProjectState>
<option name="scale" value="0.6180048661800487" />
</ProjectState>
</option>
</component>
</project>

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<application
android:allowBackup="true"
@ -10,11 +15,18 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.App1"
android:theme="@style/Base.Theme.App1"
tools:targetApi="31">
<service
android:name=".MyService"
android:enabled="true"
android:exported="true" />
<activity
android:name=".MainActivity3"
android:exported="false" />
<activity
android:name=".personFragment"
android:exported="false" />
<activity
android:name=".MainActivity2"
android:exported="false" />
@ -32,6 +44,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".IndexActivity"/>
</application>
</manifest>

@ -0,0 +1,70 @@
package com.example.app1;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import java.util.ArrayList;
import java.util.List;
public class DBHelper extends SQLiteOpenHelper {
// 数据库名称和版本号
private static final String DATABASE_NAME = "user_db";
private static final int DATABASE_VERSION = 1;
// 表名和列名
private static final String TABLE_USERS = "users";
private static final String COLUMN_ID = "id";
private static final String COLUMN_USERNAME = "username";
private static final String COLUMN_PASSWORD = "password";
// 创建用户表的SQL语句
private static final String SQL_CREATE_TABLE_USERS =
"CREATE TABLE " + TABLE_USERS + " (" +
COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," +
COLUMN_USERNAME + " TEXT," +
COLUMN_PASSWORD + " TEXT)";
// 构造方法
public DBHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
// 创建用户表
db.execSQL(SQL_CREATE_TABLE_USERS);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// 数据库升级时执行的操作(暂不处理)
}
public List<User> getAllUsers() {
List<User> userList = new ArrayList<>();
String selectQuery = "SELECT * FROM " + TABLE_USERS;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// 遍历游标,并将数据添加到用户列表中
if (cursor.moveToFirst()) {
do {
User user = new User();
user.setId(cursor.getInt(cursor.getColumnIndex(COLUMN_ID)));
user.setUsername(cursor.getString(cursor.getColumnIndex(COLUMN_USERNAME)));
user.setPassword(cursor.getString(cursor.getColumnIndex(COLUMN_PASSWORD)));
userList.add(user);
} while (cursor.moveToNext());
}
// 关闭游标和数据库连接
cursor.close();
db.close();
return userList;
}
}

@ -0,0 +1,79 @@
package com.example.app1;
import android.app.FragmentTransaction;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;
public class IndexActivity extends AppCompatActivity implements View.OnClickListener{
private LinearLayout musicLine,findLine,liveLine,personLine;
private TextView lastSelectedText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.index_daohan);
init();
switchFragment(new musicFragment());
setDefaultTextColor(findViewById(R.id.wenzi1)); // 设置默认选中项的文字颜色
lastSelectedText = findViewById(R.id.wenzi1);
}
private void init(){
musicLine = findViewById(R.id.gaohan1);
musicLine.setOnClickListener(this);
findLine = findViewById(R.id.gaohan2);
findLine.setOnClickListener(this);
liveLine = findViewById(R.id.gaohan3);
liveLine.setOnClickListener(this);
personLine = findViewById(R.id.gaohan4);
personLine.setOnClickListener(this);
}
private void setDefaultTextColor(TextView text) {
text.setTextColor(Color.parseColor("#FF4081")); // 设置默认选中项的文字颜色
}
private void resetTextColor(TextView text) {
text.setTextColor(Color.parseColor("#000000")); // 设置默认项的文字颜色为默认颜色
}
@Override
public void onClick(View view){
resetTextColor(lastSelectedText); // 恢复上一个选中项的文字颜色为默认颜色
if (view.getId() == R.id.gaohan1) {
switchFragment(new musicFragment());
lastSelectedText = findViewById(R.id.wenzi1);
setDefaultTextColor(lastSelectedText);
} else if (view.getId() == R.id.gaohan2) {
switchFragment(new findFragment());
lastSelectedText = findViewById(R.id.wenzi2);
setDefaultTextColor(lastSelectedText);
} else if (view.getId() == R.id.gaohan3) {
switchFragment(new liveFragment());
lastSelectedText = findViewById(R.id.wenzi3);
setDefaultTextColor(lastSelectedText);
} else if (view.getId() == R.id.gaohan4) {
switchFragment(new personFragment());
lastSelectedText = findViewById(R.id.wenzi4);
setDefaultTextColor(lastSelectedText);
}
}
private void switchFragment(Fragment fragment) {
getSupportFragmentManager().beginTransaction().replace(R.id.gaohan, fragment).commit();
}
public void tuichudenglu(View view){
Intent intent2 = new Intent(IndexActivity.this, MainActivity.class);
startActivity(intent2);
}
}

@ -28,9 +28,11 @@ public class MainActivity extends AppCompatActivity {
//监听按钮,如果点击,就跳转
Intent intent = new Intent();
//前一个MainActivity.this是目前页面后面一个是要跳转的下一个页面
intent.setClass(MainActivity.this,MainActivity2.class);
startActivity(intent);
}
});
}
}

@ -1,10 +1,17 @@
package com.example.app1;
import android.annotation.SuppressLint;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
@ -12,28 +19,89 @@ import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import java.util.List;
public class MainActivity2 extends AppCompatActivity {
public class MainActivity2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//这个是获取布局文件的,这里是你下一个页面的布局文件//注意这个是跳转界面的不能设置错,应该是第一个
setContentView(R.layout.user_login);
//获取按钮
Button button = (Button) findViewById(R.id.regist);
private EditText username;
private EditText password;
private Button login;
private Button startServiceButton;
private boolean isServiceRunning = false;
private DBHelper dbHelper; // 数据库助手类
//按钮进行监听
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//监听按钮,如果点击,就跳转
Intent intent = new Intent();
//前一个MainActivity.this是目前页面后面一个是要跳转的下一个页面
intent.setClass(MainActivity2.this,MainActivity3.class);
startActivity(intent);
}
});
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.user_login);
username = findViewById(R.id.username);
password = findViewById(R.id.password);
login = findViewById(R.id.login);
startServiceButton = findViewById(R.id.btnStartService);
// 创建通知渠道
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel("channel_id", "Channel Name", NotificationManager.IMPORTANCE_DEFAULT);
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
startServiceButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (!isServiceRunning) {
startMyService();
isServiceRunning = true;
}
}
});
dbHelper = new DBHelper(MainActivity2.this); // 初始化数据库助手类
login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String strUsername = username.getText().toString().trim();
String strPassword = password.getText().toString().trim();
// 获取所有用户数据
List<User> userList = dbHelper.getAllUsers();
// 检查是否有用户数据
if (!userList.isEmpty()) {
// 遍历用户数据列表
for (User user : userList) {
String savedUsername = user.getUsername();
String savedPassword = user.getPassword();
// 检查用户名和密码是否匹配
if (strUsername.equals(savedUsername) && strPassword.equals(savedPassword)) {
Toast.makeText(MainActivity2.this, "恭喜,登录成功!", Toast.LENGTH_SHORT).show();
Intent intent1 = new Intent(MainActivity2.this, IndexActivity.class);
startActivity(intent1);
return; // 如果匹配成功,则直接返回,不再继续循环
}
}
// 如果循环结束仍未匹配成功,则提示用户名或密码错误
Toast.makeText(MainActivity2.this, "用户名或密码错误!", Toast.LENGTH_SHORT).show();
} else {
// 如果用户数据列表为空,则提示用户名或密码错误
Toast.makeText(MainActivity2.this, "用户名或密码错误!", Toast.LENGTH_SHORT).show();
}
}
});
}
private void startMyService() {
Intent serviceIntent = new Intent(this, MyService.class);
startService(serviceIntent);
}
//点击注册按钮时,跳转到注册界面
public void zhuce(View view) {
Intent intent2 = new Intent(MainActivity2.this, MainActivity3.class);
startActivity(intent2);
}
}

@ -1,20 +1,109 @@
package com.example.app1;
import android.content.ContentValues;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import android.view.View;
import android.widget.CheckBox;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
public class MainActivity3 extends AppCompatActivity {
public class MainActivity3 extends AppCompatActivity implements View.OnClickListener {
private TextView reg_username;
private TextView reg_password;
private TextView reg_sure_password;
private RadioGroup radiogroup;
private CheckBox ah1, ah2, ah3, ah4;
private String sex = "男";
private String aihao1 = "", aihao2 = "", aihao3 = "", aihao4 = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//这个是获取布局文件的,这里是你下一个页面的布局文件//注意这个是跳转界面的不能设置错,应该是第一个
setContentView(R.layout.user_register);
reg_username = findViewById(R.id.reg_username);
reg_password = findViewById(R.id.reg_password);
reg_sure_password = findViewById(R.id.reg_sure_password);
findViewById(R.id.reg_register).setOnClickListener(this);
radiogroup = findViewById(R.id.rp);
radiogroup.setOnCheckedChangeListener((group, checkedId) -> {
if (checkedId == R.id.man) {
sex = "男";
} else if (checkedId == R.id.woman) {
sex = "女";
}
});
ah1 = findViewById(R.id.chang);
ah2 = findViewById(R.id.tiao);
ah3 = findViewById(R.id.rap);
ah4 = findViewById(R.id.basketball);
ah1.setOnCheckedChangeListener((buttonView, isChecked) -> {
aihao1 = isChecked ? "唱" : "";
});
ah2.setOnCheckedChangeListener((buttonView, isChecked) -> {
aihao2 = isChecked ? "跳" : "";
});
ah3.setOnCheckedChangeListener((buttonView, isChecked) -> {
aihao3 = isChecked ? "rap" : "";
});
ah4.setOnCheckedChangeListener((buttonView, isChecked) -> {
aihao4 = isChecked ? "篮球" : "";
});
}
@Override
public void onClick(View view) {
String username = reg_username.getText().toString().trim();
String password = reg_password.getText().toString().trim();
String surepassword = reg_sure_password.getText().toString().trim();
if (username.isEmpty() || password.isEmpty() || surepassword.isEmpty()) {
Toast.makeText(MainActivity3.this, "用户名或密码不能为空!", Toast.LENGTH_SHORT).show();
return;
}
if (!password.equals(surepassword)) {
Toast.makeText(MainActivity3.this, "两次输入密码不一致!", Toast.LENGTH_SHORT).show();
return;
}
// 保存用户名和密码到数据库
DBHelper dbHelper = new DBHelper(MainActivity3.this);
SQLiteDatabase db = null;
try {
db = dbHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("username", username);
values.put("password", password);
long result = db.insert("users", null, values);
if (result == -1) {
Toast.makeText(MainActivity3.this, "注册失败!", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(MainActivity3.this, "注册成功!", Toast.LENGTH_SHORT).show();
// 如果一切正常,跳转到下一个页面
Intent intent1 = new Intent(this, MainActivity2.class);
startActivity(intent1);
}
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(MainActivity3.this, "注册失败!", Toast.LENGTH_SHORT).show();
} finally {
if (db != null) {
db.close(); // 关闭数据库连接
}
}
}
public void fanhui(View view) {
// 在这里你可以添加检查未保存信息的逻辑
Intent intent5 = new Intent(MainActivity3.this, MainActivity2.class);
startActivity(intent5);
}
}
}

@ -0,0 +1,85 @@
package com.example.app1;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.os.Binder;
import android.os.Handler;
import android.os.IBinder;
import androidx.core.app.NotificationCompat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class MyService extends Service {
private static final int NOTIFICATION_ID = 1;
private final IBinder binder = new LocalBinder();
private Handler handler;
private Runnable runnable;
public MyService() {
}
@Override
public IBinder onBind(Intent intent) {
return binder;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
startForeground(NOTIFICATION_ID, createNotification());
handler = new Handler();
runnable = new Runnable() {
@Override
public void run() {
showNotification();
handler.postDelayed(this, 60 * 1000); // 每隔一分钟发送通知
}
};
handler.post(runnable);
return START_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
handler.removeCallbacks(runnable);
}
private void showNotification() {
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = createNotification();
notificationManager.notify(NOTIFICATION_ID, notification);
}
private Notification createNotification() {
// 获取当前时间
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
Date date = new Date(System.currentTimeMillis());
// 创建通知点击时要启动的意图
Intent notificationIntent = new Intent(this, MainActivity2.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
// 创建通知
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, "channel_id")
.setContentTitle("提醒系统当前时间")
.setContentText("系统当前时间为:" + formatter.format(date)) // 在通知文本中显示当前时间
.setSmallIcon(R.drawable.ic_launcher_background)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
return builder.build();
}
public class LocalBinder extends Binder {
MyService getService() {
return MyService.this;
}
}
}

@ -0,0 +1,43 @@
package com.example.app1;
public class User {
private int id;
private String username;
private String password;
public User() {
// 默认构造函数
}
public User(int id, String username, String password) {
this.id = id;
this.username = username;
this.password = password;
}
// Getter 和 Setter 方法
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}

@ -0,0 +1,99 @@
package com.example.app1;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
public class findFragment extends Fragment {
private ListView listView;
private TextView contentText;
private ListView playlistView;
private int lastClickedPosition = -1; // 记录上次点击的位置
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_find, container, false);
init(view);
// 默认显示热搜榜内容
String[] defaultPlaylist = getPlaylistForItem(0);
ArrayAdapter<String> defaultPlaylistAdapter = new ArrayAdapter<>(requireContext(),
android.R.layout.simple_list_item_1, defaultPlaylist);
playlistView.setAdapter(defaultPlaylistAdapter);
return view;
}
private void init(View view) {
// 初始化列表和内容显示区域
listView = view.findViewById(R.id.list_view);
contentText = view.findViewById(R.id.content_text);
playlistView = view.findViewById(R.id.playlist_view);
// 列表项
final String[] listItems = {"热搜榜", "儿童热门榜", "影视热搜", "国风热搜", "外语热搜", "情歌热搜", "纯音乐热搜", "综艺热搜"};
ArrayAdapter<String> adapter = new ArrayAdapter<>(requireContext(),
android.R.layout.simple_list_item_1, listItems);
listView.setAdapter(adapter);
// 记录上次点击的位置
lastClickedPosition = 0;
// 点击列表项更新内容显示区域的内容和右侧的歌单内容
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// 恢复上一个点击项的背景颜色
if (lastClickedPosition != -1) {
View lastClickedView = parent.getChildAt(lastClickedPosition);
lastClickedView.setBackgroundColor(Color.TRANSPARENT); // 恢复默认背景色
}
// 获取点击的视图
View clickedView = parent.getChildAt(position);
// 修改背景颜色为粉色
clickedView.setBackgroundColor(Color.parseColor("#FBBCDC")); // 粉色
// 更新上次点击的位置
lastClickedPosition = position;
// 更新右侧歌单内容
String[] playlist = getPlaylistForItem(position);
ArrayAdapter<String> playlistAdapter = new ArrayAdapter<>(requireContext(),
android.R.layout.simple_list_item_1, playlist);
playlistView.setAdapter(playlistAdapter);
}
});
}
private String[] getPlaylistForItem(int position) {
// 根据位置返回相应的歌单内容
switch (position) {
case 0:
return new String[]{"无名的人", "落", "如果可以","若月亮没有来","梨花香","下辈子早点相遇","如果爱忘了","离别开出花","dadada","别爱太满别睡太晚","我把故事酿成酒","梦驼铃","安河桥","你"};
case 1:
return new String[]{"贝乐虎儿歌", "宝宝巴士", "睡前故事晚安宝贝","寓言故事","黑猫警长救援队","兔小贝睡前故事","宝宝巴士儿歌","迷你特工队","咕力律动儿歌","冰雪奇缘","海绵宝宝","海底小纵队儿歌","一千零一夜睡前故事","熊出没"};
case 2:
return new String[]{"与凤行", "花间令", "热辣滚烫","繁花","烈焰","追风者","别对我动心","谢谢你温暖我","南来北往","在暴雪时分","小日子","大理寺少卿游","祈今朝","周处除三害"};
case 3:
return new String[]{"霜雪千年", "青花瓷", "红昭愿","上春山","卜卦","天下","桃花诺","画心","红尘客栈","年轮","牵丝戏","若梦","赤伶","武家坡"};
case 4:
return new String[]{"fate", "magnetic", "call of silence","see you again","back seat","swag","love story","repeat","hey oh","sheesh","wake","any song","heaven","doar cu tine"};
case 5:
return new String[]{"紫荆花盛开", "不如见一面", "悬溺","你冷落我我就放弃你","谁","犯错","你把爱情给了谁","负我不负她","霜雪千年","沉溺","打歌妹","浴室","爱情转移","把回忆拼好给你"};
case 6:
return new String[]{"daydream", "碧苍战歌", "瞬间的永恒","daylight","windy hill","夜空的寂静","神明无止","误入迷失森林","秋的思念","诀别书","水墨兰亭","城南花已开","summer","引忘川"};
case 7:
return new String[]{"就是爱你", "谈恋爱", "慢冷","流沙","暖暖","小宇","桃花运","挚友","问","一眼","怎样","想你时风起","我的美丽","分飞"};
default:
return new String[]{};
}
}
}

@ -0,0 +1,22 @@
package com.example.app1;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
public class liveFragment extends Fragment {
private RecyclerView horizontalRecyclerView;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_live, container, false);
return view;
}
}

@ -0,0 +1,21 @@
package com.example.app1;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.fragment.app.Fragment;
public class musicFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_music,container,false);
init(view);
return view;
}
private void init(View view) {
}
}

@ -0,0 +1,165 @@
package com.example.app1;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.List;
public class personFragment extends Fragment {
private ListView listNew;
private TextView clockTextView;
private final Handler handler = new Handler(Looper.getMainLooper());
private List<Map<String,Object>> lists;
private SimpleAdapter adapter;
private int[][] iv={{R.drawable.gequ1,R.drawable.gequ2,R.drawable.gequ3,R.drawable.gequ4,R.drawable.gequ5},
{R.drawable.gequ1,R.drawable.gequ2,R.drawable.gequ3,R.drawable.gequ4,R.drawable.gequ5},
{R.drawable.gequ1,R.drawable.gequ2,R.drawable.gequ3,R.drawable.gequ4,R.drawable.gequ5},
{R.drawable.gequ1,R.drawable.gequ2,R.drawable.gequ3,R.drawable.gequ4,R.drawable.gequ5}};
private String[][] zuopin={{"作品1","作品2","作品3","作品4","作品5"},
{"作品11","作品12","作品13","作品14","作品15"},
{"作品21","作品22","作品23","作品24","作品25"},
{"作品31","作品32","作品33","作品34","作品35"}};
private String[][]zuozhe={{"作者1","作者2","作者3","作者4","作者5"},
{"作者11","作者12","作者13","作者14","作者15"},
{"作者21","作者22","作者23","作者24","作者25"},
{"作者31","作者32","作者33","作者34","作者35"}};
Button button1,button2,button3,button4;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_person, container, false);
init(view);
// 绑定 TextView
clockTextView = view.findViewById(R.id.clockTextView);
// 启动时钟更新线程
updateClock();
return view;
}
private void updateClock() {
Thread thread = new Thread() {
@Override
public void run() {
try {
while (!isInterrupted()) {
long currentTimeMillis = System.currentTimeMillis();
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss", Locale.getDefault());
String currentTime = timeFormat.format(new Date(currentTimeMillis));
handler.post(() -> clockTextView.setText(currentTime));
Thread.sleep(1000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
};
thread.start();
}
private void init(View view) {
listNew = view.findViewById(R.id.list_new);
button1 = view.findViewById(R.id.bu1);
button2 = view.findViewById(R.id.bu2);
button3 = view.findViewById(R.id.bu3);
button4 = view.findViewById(R.id.bu4);
//监听器
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int data = getDataFromView(view);
updateListView(data);
}
});
button2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int data = getDataFromView(view);
updateListView(data);
}
});
button3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int data = getDataFromView(view);
updateListView(data);
}
});
button4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
int data=getDataFromView(view);
updateListView(data);
}
});
}
public int getDataFromView(View view) {
if (view.getId() == R.id.bu1) {
return onClick(view);
} else if (view.getId() == R.id.bu2) {
return onClick(view);
} else if (view.getId() == R.id.bu3) {
return onClick(view);
} else if (view.getId() == R.id.bu4) {
return onClick(view);
}
return 0;
}
//适配器
public void updateListView(int data) {
lists=new ArrayList<>();
for(int i=0;i<zuopin[data].length;i++){
Map<String,Object>map=new HashMap<>();
map.put("iv",iv[data][i]);
map.put("zuopin",zuopin[data][i]);
map.put("zuozhe",zuozhe[data][i]);
lists.add(map);
}
adapter=new SimpleAdapter(requireContext(),lists,R.layout.item_person
,new String[]{"iv","zuopin","zuozhe"}
,new int[]{R.id.iv,R.id.zuopin,R.id.zuozhe});
listNew.setAdapter(adapter);
}
@SuppressLint("ResourceAsColor")
public int onClick(View view) {
if (view.getId() == R.id.bu1) {
return 0;
} else if (view.getId() == R.id.bu2) {
return 1;
} else if (view.getId() == R.id.bu3) {
return 2;
} else if (view.getId() == R.id.bu4) {
return 3; }
return 0;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:radius="8dp" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 570 B

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/pink"/>
<corners android:radius="20dp" /> <!-- Adjust the radius to change the amount of rounding -->
<stroke
android:color="@android:color/white"
android:width="1dp" />
</shape>

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

@ -6,8 +6,8 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="@color/pink"
>
android:background="@color/pink">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -21,8 +21,13 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/one"
android:textSize="45dp"
android:gravity="top|center"
android:paddingTop="100dp"
android:textStyle="bold"
android:textColor="@color/palevioletred1"
android:layout_centerHorizontal="true"
android:text="点击进入登录界面"
android:text="HelloKitty 音乐"
tools:ignore="MissingConstraints,UnknownId"
android:background="@color/pink"/>
android:background="@drawable/fengmianbackground"/>
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<!--首页-->
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:id="@+id/gaohan1">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:src="@drawable/music"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="音乐"
android:id="@+id/wenzi1"
android:textColor="@color/black"
android:textSize="18sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:id="@+id/gaohan2">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:src="@drawable/find"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="发现"
android:id="@+id/wenzi2"
android:textColor="@color/black"
android:textSize="18sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:id="@+id/gaohan3">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:src="@drawable/live"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="直播"
android:id="@+id/wenzi3"
android:textColor="@color/black"
android:textSize="18sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:id="@+id/gaohan4">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="2dp"
android:src="@drawable/person"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="主页"
android:id="@+id/wenzi4"
android:textColor="@color/black"
android:textSize="18sp"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,177 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/tupianbackground8">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="9"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="搜索"
android:textSize="18sp"
android:textColor="@color/palevioletred"
android:layout_gravity="center"
android:layout_marginRight="10dp"/>
<EditText
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="45"
android:gravity="center"
android:hint="猜你想搜青花瓷"
android:background="@drawable/rounded_corner"
android:layout_marginRight="10dp"/>
<ImageButton
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:onClick="sousuo"
android:background="@drawable/sousuo"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp">
<Button
android:id="@+id/b1"
android:onClick="ritui"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="10sp"
android:textColor="@color/white"
android:text="歌手分类" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="10dp">
<Button
android:id="@+id/b2"
android:onClick="paihang"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="10sp"
android:textColor="@color/white"
android:text="排行榜" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="10dp">
<Button
android:id="@+id/b3"
android:onClick="xihuan"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="10sp"
android:textColor="@color/white"
android:text="听歌识曲" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="10dp">
<Button
android:id="@+id/b4"
android:onClick="xihuan"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="10sp"
android:textColor="@color/white"
android:text="自助发歌" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!-- 列表 -->
<ListView
android:id="@+id/list_view"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:divider="@android:color/darker_gray"
android:dividerHeight="1dp"/>
<!-- 右侧内容显示区域 -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<!-- 歌单列表 -->
<ListView
android:id="@+id/playlist_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:id="@+id/content_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:layout_weight="1"
android:orientation="horizontal"
android:background="@color/pink"
android:padding="10dp">
<ImageButton
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/tuijian3"
android:layout_marginRight="10dp"/>
<TextView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:text="正在播放的音乐"
android:gravity="center"
android:textSize="18sp"
android:textColor="@color/white"
android:layout_marginRight="10dp"/>
<ImageButton
android:layout_width="70dp"
android:layout_height="70dp"
android:background="@drawable/bofanganniu"
android:layout_marginRight="10dp"/>
<ImageButton
android:layout_width="55dp"
android:layout_height="55dp"
android:background="@drawable/liebiao2"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@drawable/tupianbackground5">
<!-- 垂直布局 -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<!-- 文字提示 -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="这里有你想看、爱看的直播"
android:textSize="20sp"
android:gravity="center"
android:textColor="@color/palevioletred"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,264 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:padding="15dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="搜索"
android:textSize="18sp"
android:textColor="@color/palevioletred"
android:layout_gravity="center"
android:layout_marginRight="10dp"/>
<EditText
android:id="@+id/search"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="45"
android:hint="猜你想搜青花瓷"
android:gravity="center"
android:background="@drawable/rounded_corner"
android:layout_marginRight="15dp"/>
<ImageButton
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:onClick="sousuo"
android:background="@drawable/sousuo"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:layout_weight="2"
android:orientation="horizontal"
android:padding="15dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp">
<Button
android:id="@+id/mrtj"
android:onClick="ritui"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="18sp"
android:textColor="@color/white"
android:text="每日推荐"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginRight="5dp">
<Button
android:id="@+id/phb"
android:onClick="paihang"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="18sp"
android:textColor="@color/white"
android:text="排行榜"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginLeft="5dp">
<Button
android:id="@+id/cnxh"
android:onClick="xihuan"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="18sp"
android:textColor="@color/white"
android:text="猜你喜欢"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="6"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="专属推荐"
android:textSize="18sp"
android:textColor="@color/palevioletred"
android:layout_gravity="left" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_margin="5dp">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:src="@drawable/tuijian3"
android:layout_marginRight="20dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="音乐名字1"
android:layout_weight="1"
android:textSize="18sp"
android:textColor="@color/violet"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="作者1"
android:layout_weight="1"
android:textSize="18sp"
android:textColor="@color/violet"/>
</LinearLayout>
<ImageButton
android:layout_width="120dp"
android:layout_height="120dp"
android:background="@drawable/bofang"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_margin="5dp">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:src="@drawable/tuijian2"
android:layout_marginRight="20dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="音乐名字2"
android:layout_weight="1"
android:textSize="18sp"
android:textColor="@color/violet"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="作者2"
android:layout_weight="1"
android:textSize="18sp"
android:textColor="@color/violet"/>
</LinearLayout>
<ImageButton
android:layout_width="120dp"
android:layout_height="120dp"
android:background="@drawable/bofang"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_margin="5dp">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:src="@drawable/tuijian1"
android:layout_marginRight="20dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="音乐名字3"
android:layout_weight="1"
android:textSize="18sp"
android:textColor="@color/violet"/>
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:text="作者3"
android:layout_weight="1"
android:textSize="18sp"
android:textColor="@color/violet"/>
</LinearLayout>
<ImageButton
android:layout_width="120dp"
android:layout_height="120dp"
android:background="@drawable/bofang"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:layout_weight="1"
android:orientation="horizontal"
android:background="@color/pink"
android:padding="10dp">
<ImageButton
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/tuijian3"
android:layout_marginRight="10dp"/>
<TextView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:text="正在播放的音乐"
android:gravity="center"
android:textSize="18sp"
android:textColor="@color/white"
android:layout_marginRight="10dp"/>
<ImageButton
android:layout_width="70dp"
android:layout_height="70dp"
android:background="@drawable/bofanganniu"
android:layout_marginRight="10dp"/>
<ImageButton
android:layout_width="55dp"
android:layout_height="55dp"
android:background="@drawable/liebiao2"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/pink2"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@color/lightpink">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="1"
android:gravity="left">
<Button
android:id="@+id/tcdl"
android:text="退出登录"
android:textSize="16sp"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="tuichudenglu"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="1"
android:gravity="center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="个人界面"
android:textSize="18sp"
android:textColor="@color/palevioletred"
android:gravity="center"/>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="right"
android:orientation="horizontal">
<ImageView
android:layout_width="34dp"
android:layout_height="34dp"
android:layout_gravity="center"
android:background="@drawable/sousuo"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="240dp"
android:orientation="vertical"
android:background="@drawable/tupianbackground12">
<TextView
android:id="@+id/clockTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:text="00:00:00"
tools:text="00:00:00"
android:textColor="@color/palevioletred"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:layout_weight="11"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal">
<include layout="@layout/layout_person0" />
</FrameLayout>
<FrameLayout
android:id="@+id/gequ"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="8"
android:gravity="center"
android:orientation="vertical">
<include layout="@layout/layout_person1" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:layout_weight="2"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:gravity="center"
android:layout_weight="2"
android:orientation="horizontal"
android:background="@color/pink"
android:padding="10dp">
<ImageButton
android:layout_width="60dp"
android:layout_height="60dp"
android:background="@drawable/tuijian3"
android:layout_marginRight="10dp"/>
<TextView
android:layout_width="180dp"
android:layout_height="wrap_content"
android:text="正在播放的音乐"
android:gravity="center"
android:textSize="18sp"
android:textColor="@color/white"
android:layout_marginRight="10dp"/>
<ImageButton
android:layout_width="70dp"
android:layout_height="70dp"
android:background="@drawable/bofanganniu"
android:layout_marginRight="10dp"/>
<ImageButton
android:layout_width="55dp"
android:layout_height="55dp"
android:background="@drawable/liebiao2"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
tools:context=".IndexActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="@+id/gaohan"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<!--底部导航-->
<include layout="@layout/content"/>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp">
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"
android:id="@+id/iv"
android:layout_centerVertical="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="作品名字"
android:id="@+id/zuopin"
android:textSize="20sp"
android:layout_alignTop="@id/iv"
android:layout_toRightOf="@id/iv"
android:layout_marginTop="20dp"
android:layout_marginLeft="30dp"
android:textColor="@color/pink"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="作者"
android:id="@+id/zuozhe1"
android:textSize="20sp"
android:layout_alignTop="@id/iv"
android:layout_toRightOf="@id/iv"
android:layout_marginTop="70dp"
android:layout_marginLeft="30dp"
android:textColor="@color/pink"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="作者名字"
android:id="@+id/zuozhe"
android:textSize="20sp"
android:layout_alignTop="@id/iv"
android:layout_toRightOf="@id/iv"
android:layout_marginTop="70dp"
android:layout_marginLeft="130dp"
android:textColor="@color/pink"/>
</RelativeLayout>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="46dp"
android:id="@+id/bu1"
android:layout_weight="1"
android:text="收藏"
android:textSize="16sp"/>
<Button
android:layout_width="0dp"
android:layout_height="46dp"
android:id="@+id/bu2"
android:layout_weight="1"
android:text="我喜欢"
android:textSize="16sp"/>
<Button
android:layout_width="0dp"
android:layout_height="46dp"
android:id="@+id/bu3"
android:layout_weight="1"
android:text="下载"
android:textSize="16sp"/>
<Button
android:layout_width="0dp"
android:layout_height="46dp"
android:id="@+id/bu4"
android:layout_weight="1"
android:text="已购买"
android:textSize="16sp"/>
</LinearLayout>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/list_new"/>
</LinearLayout>

@ -2,7 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:background="@drawable/tupianbackground4">
<LinearLayout
android:layout_width="match_parent"
@ -12,16 +13,16 @@
android:orientation="vertical">
<ImageView
android:layout_width="200dp"
android:layout_height="200dp"
android:layout_width="170dp"
android:layout_height="170dp"
android:layout_gravity="center_horizontal"
android:src="@drawable/note" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AAAA"
android:textColor="#000000"
android:text="登录界面"
android:textColor="@color/palevioletred"
android:textSize="22sp"
android:textStyle="italic" />
</LinearLayout>
@ -29,7 +30,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="50dp"
android:layout_marginTop="20dp"
android:orientation="horizontal">
<ImageView
android:layout_height="30dp"
@ -43,7 +44,8 @@
android:hint="username"
android:maxLength="10"
android:maxLines="1"
android:textAlignment="center" />
android:textAlignment="center"
android:textColorHint="@color/pink" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -63,27 +65,37 @@
android:maxLength="16"
android:maxLines="1"
android:textAlignment="center"
android:inputType="textPassword"/>
android:inputType="textPassword"
android:textColorHint="@color/pink"/>
</LinearLayout>
<Button
android:id="@+id/login"
android:onClick="denglu"
android:layout_width="250dp"
android:layout_height="50dp"
android:textSize="18sp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="60dp"
android:background="@drawable/button_login"
android:layout_marginTop="30dp"
android:textColor="#FFFFFF"
android:text="登录"
/>
android:text="登录" />
<Button
android:id="@+id/regist"
android:onClick="zhuce"
android:layout_width="250dp"
android:layout_height="50dp"
android:textSize="18sp"
android:layout_marginTop="20dp"
android:layout_gravity="center_horizontal"
android:textColor="#FFFFFF"
android:text="注册" />
<Button
android:id="@+id/btnStartService"
android:onClick="zhuce"
android:layout_width="250dp"
android:layout_height="50dp"
android:textSize="18sp"
android:layout_marginTop="20dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/button_regist"
android:textColor="#FFFFFF"
android:text="注册"
/>
android:text="开启时间推送服务" />
</LinearLayout>

@ -2,7 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:orientation="vertical"
android:background="@drawable/tupianbackground2">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -18,10 +19,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:textColor="#000000"
android:textStyle="italic"
android:text="AAAA"/>
</LinearLayout>
android:text="注册界面"
android:textColor="@color/palevioletred" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -40,7 +41,8 @@
android:textAlignment="center"
android:maxLength="10"
android:maxLines="1"
android:hint="用户名10位"/>
android:hint="用户名10位"
android:textColorHint="@color/pink"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -59,7 +61,9 @@
android:textAlignment="center"
android:maxLength="16"
android:maxLines="1"
android:hint="密码6-16位"/>
android:inputType="numberPassword"
android:hint="密码6-16位"
android:textColorHint="@color/pink"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -78,8 +82,9 @@
android:textAlignment="center"
android:maxLength="16"
android:maxLines="1"
android:inputType="textPassword"
android:hint="确认密码"/>
android:inputType="numberPassword"
android:hint="再次输入密码"
android:textColorHint="@color/pink"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -95,29 +100,94 @@
<RadioGroup
android:layout_width="270dp"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:id="@+id/rp">
<RadioButton
android:id="@+id/reg_man"
android:id="@+id/man"
android:layout_width="wrap_content"
android:checked="true"
android:layout_height="wrap_content"
android:text="男"/>
android:text="男"
android:textColor="@color/palevioletred"/>
<RadioButton
android:id="@+id/reg_woman"
android:id="@+id/woman"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="女"/>
android:text="女"
android:textColor="@color/palevioletred"/>
</RadioGroup>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/fuxian"
android:text="爱好: "
android:textSize="20sp"
android:textColor="@color/palevioletred"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/chang"
android:text="唱 "
android:textColor="@color/palevioletred"
android:textSize="16sp">
</CheckBox>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tiao"
android:text="跳 "
android:textColor="@color/palevioletred"
android:textSize="16sp">
</CheckBox>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/rap"
android:textColor="@color/palevioletred"
android:text="rap "
android:textSize="16sp">
</CheckBox>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/basketball"
android:text="篮球 "
android:textColor="@color/palevioletred"
android:textSize="16sp">
</CheckBox>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:layout_marginTop="80dp">
<Button
android:id="@+id/reg_register"
android:layout_width="280dp"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_marginTop="80dp"
android:onClick="qdzhuce"
android:textSize="18sp"
android:layout_gravity="center_horizontal"
android:layout_marginRight="50dp"
android:background="@drawable/button_login"
android:textColor="#FFFFFF"
android:text="注册"/>
<Button
android:id="@+id/quxiao"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:onClick="fanhui"
android:textSize="18sp"
android:background="@drawable/button_login"
android:textColor="#FFFFFF"
android:text="取消"/>
</LinearLayout>
</LinearLayout>

@ -2,6 +2,19 @@
<resources>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="blackgreen">#006400</color>
<color name="blue">#ADD8E6</color>
<color name="blue1">#D5F5FF</color>
<color name="lightblue">#E0F5FB</color>
<color name="pink">#FBBCDC</color>
<color name="pink2">#FFFAFC</color>
<color name="peachpuff">#ffdab9</color>
<color name="deeppink">#ff1493</color> <!-- 深粉红色 -->
<color name="fuchsia">#ff00ff</color> <!-- 紫红色 -->
<color name="magenta">#ff00ff</color> <!-- 红紫色 -->
<color name="red">#ff0000</color> <!-- 红色 -->
<color name="violet">#ee82ee</color> <!-- 紫罗兰色 -->
<color name="lightpink">#FFDCE1</color> <!-- 亮粉红色 -->
<color name="palevioletred">#db7093</color> <!-- 苍紫罗兰色 -->
<color name="palevioletred1">#E483A3</color> <!-- 苍紫罗兰色 -->
</resources>

@ -1,9 +1,9 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.App1" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
<item name="colorPrimary">@color/pink</item>
<item name="android:colorPrimaryDark">@color/blue</item>
<item name="colorAccent">@color/pink</item>
</style>
<style name="Theme.App1" parent="Base.Theme.App1" />
</resources>
Loading…
Cancel
Save