【GT-安卓应用开发之错题率统计】

本文介绍了如何在安卓应用中实现错题率统计和成绩排行的展示。通过使用MPChartLib库绘制柱形图来呈现错题记录,并展示了获取后台数据、数据排序和渲染的过程,最终呈现出直观的数据分析界面。
摘要由CSDN通过智能技术生成

前言:对于学生的答题(学习)情况,数据是直观的表现,在实际开发中也需要涉及到大量的数据统计与分析,我们经常通过图表结合来更加直观的展现数据。

        接下来,记录一下最近做的一个错题率统计与总成绩排行。整个界面是由上半部分的柱形图来展现错题记录,下半部分则是已提交(答题)人员的成绩排名。主要涉及到的几个点就是调用接口获取后台数据、数据的整理(排序)、数据的展现(包括柱形图与排行列表),我们按照开发的流程来了解。

        第一步,界面设计

        界面布局比较简单,直接贴代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.administrator.parentproject.activity.TJActivity">
    <RelativeLayout
        android:id="@+id/relative"
        style="@style/TitleStyle_Relative">

        <ImageView
            android:id="@+id/back"
            style="@style/TitleStyle_Back"
            android:layout_alignParentBottom="true" />

        <TextView
            android:id="@+id/title_tv"
            style="@style/TitleStyle_Text"
            android:layout_centerHorizontal="true"
            android:singleLine="true"
            android:text="错题率" />
    </RelativeLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="6"
        android:orientation="horizontal"
        android:layout_margin="@dimen/dp_10"
        android:background="@color/pink">
        <com.github.mikephil.charting.charts.BarChart
            android:id="@+id/bar_chart"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="@dimen/dp_20"/>
    </LinearLayout>
    <LinearLayout
        android:layout_gravity="bottom"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="5"
        android:orientation="vertical&#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值