2021/5/26 工作日报 -- 简约记账app -- day8

完成了简约记账app的图表分析功能,优化Dialog显示并进行全面测试。使用MPAndroidChart开源库实现图表,项目涵盖Android基础知识点,如Activity、碎片、自定义对话框等,提供个人记账解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今日计划

  今日计划完成app的最后功能,图表分析

今日完成情况

  完成了图表分析的功能,优化了更多界面的Dialog显示,做了各个功能的测试,目前还未发生bug,并将app进行打包签名测试。
  图表分析界面效果:
图表分析
图表分析
  优化后的更多Dialog:
优化Dialog
  本次使用的图表功能使用的是一个开源项目,项目地址: https://github.com/PhilJay/MPAndroidChart.
  首先在包下的build.gradle文件中加入如下依赖:


allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

  然后在app下的build.gradle中加入如下依赖(第一次加的是最新的,但是发现有些接口变了,导致显示异常,还是改回此版本):

dependencies 
    implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
}

  新建listView的头布局文件,也就是柱状图的布局

<?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="wrap_content">
    <com.github.mikephil.charting.charts.BarChart
        android:id="@+id/item_chartfrag_chart"
        android:layout_width="match_parent"
        android:layout_height="300dp"/>
    <TextView
        android:id="@+id/item_chartfrag_top_tv"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        android:text="@string/no_data"
        android:textStyle="bold"
        android:textSize="20sp"
        android:gravity="center"
        android:visibility="gone"/>

</RelativeLayout>

  Fragment父类BaseChartFragment代码:

abstract public class BaseChartFragment extends Fragment {

    ListView chartLv;
    int year;
    int month;
    List<ChartItemBean> mDatas;   //数据源
    private ChartItemAdapter itemAdapter;
    BarChart barChart;  //代表柱状图的控件
    TextView chartTv;  //如果没有收支情况,显示的TextView

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        View view =  inflater.inflate(R.layout.fragment_income_chart, container, false);
        chartLv = view.findV
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值