目录
2.2 用于实现item跳转页面后的视图:chest.xml
4.1 实现列表内item的跳转:MyAdapter2.java
APP名称:今天练了没
APP版本:v2.0
一、项目总体介绍
项目背景:随着生活水平的提高,人们对于提高身体素质的要求越来越强烈,本App旨在为健身爱好者提供相应的参考查询服务,从而提高训练效率。本App包含健身计划、食物热量表、健身动作和简单的低卡食谱四个栏目,每个栏目都有相应的内容。希望用户可以通过这四个栏目的内容,加上实际运动,实现管住嘴、迈开腿,通过自己的努力实现身材管理,达到理想的健身目标。
更新日志:
○ 优化了app页面,添加了文本框使app内容更加美观,提高了可读性。
○ “热量表”栏目添加了更多常见食物的热量,添加了按钮来跳转更多信息页。
○ 删除了没有太多实际意义的“箴言”一栏,更换为实用性更多的“动作”一栏,分为胸、背、腿、肩、二头、三头、腹部七个板块,每个板块内都有效率很高的动作推荐及其细节解析。
实现技术:activity、xml、fragment、recycleview、intent
二、关键步骤与核心技术
(App源码只展更新了的部分,其他未展示的源码均与v1.0版本的源码相同)
1.文本框设置:text_border.xml
○ 在/res/layout目录创建一个text_border.xml
○ xml文件内包含对文本框的设置:颜色、粗细、圆角角度
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white"/>
<stroke
android:width="2dp"
android:color="#673AB7" />
<corners android:radius="5dp" />
</shape>
2.中间内容设计更新:
2.1 热量表:list.xml
○ 添加一个button用于进行跳转
○ 新建一个页面用于实现跳转后的页面
list.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycleView2"
android:layout_width="match_parent"
android:layout_height="580dp" />
<Button
android:id="@+id/morebutton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="更多信息" />
</LinearLayout>
跳转后的页面:moreinfo.xml:
<?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">
<Button
android:id="@+id/backbutton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="返回"
android:textSize="20sp" />
<androidx.recyclerview.widget.RecyclerView