@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 945 B |
After Width: | Height: | Size: 73 KiB |
After Width: | Height: | Size: 857 B |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 16 KiB |
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>
|
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 190 KiB |
After Width: | Height: | Size: 465 B |
After Width: | Height: | Size: 447 B |
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>
|
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 53 KiB |
After Width: | Height: | Size: 333 KiB |
After Width: | Height: | Size: 194 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 69 KiB |
After Width: | Height: | Size: 84 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 121 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 392 KiB |
After Width: | Height: | Size: 134 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 149 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 338 KiB |
@ -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>
|
@ -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>
|