您当前的位置:首页 > 毕业设计

毕业设计- Android学生点名系统

时间:2022-03-03 07:37:05 阅读数:46,105人阅读
版权声明:转载请注明出处,谢谢!
—— 未来真正会发生的事,其实完全取决于你现在做的决定。

项目介绍

系统分为学生花名册和点名两大模块,学生花名册显示所有学生列表,可以添加、编辑、删除学生信息,点名可以对每个学生考勤登记,并记录考勤课程、考勤时间,可以查看所有考勤统计信息;

项目截图

实现原理

布局文件activity_main.xml:

			<?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:orientation="vertical">

				<FrameLayout
					android:id="@+id/container"
					android:layout_width="match_parent"
					android:layout_height="match_parent" />

				<LinearLayout
					android:layout_width="match_parent"
					android:layout_height="50dp"
					android:layout_alignParentBottom="true"
					android:orientation="horizontal">

					<LinearLayout
						android:id="@+id/roll_call"
						android:layout_width="wrap_content"
						android:layout_height="match_parent"
						android:layout_weight="1"
						android:background="@android:color/white"
						android:gravity="center"
						android:orientation="vertical">

						<ImageView
							android:id="@+id/roll_call_img"
							android:layout_width="25dp"
							android:layout_height="25dp"
							android:layout_marginTop="3dp"
							android:src="@drawable/rollcall_out" />

						<TextView
							android:id="@+id/roll_call_tv"
							android:layout_width="wrap_content"
							android:layout_height="match_parent"
							android:layout_marginTop="3dp"
							android:layout_weight="1"
							android:text="点名"
							android:textColor="@color/black"
							android:textSize="12sp" />
					</LinearLayout>

					<LinearLayout
						android:id="@+id/lesson"
						android:layout_width="wrap_content"
						android:layout_height="match_parent"
						android:layout_weight="1"
						android:background="@android:color/white"
						android:gravity="center"
						android:orientation="vertical">

						<ImageView
							android:id="@+id/lesson_img"
							android:layout_width="25dp"
							android:layout_height="25dp"
							android:layout_marginTop="3dp"
							android:src="@drawable/lesson_out" />

						<TextView
							android:id="@+id/lesson_tv"
							android:layout_width="wrap_content"
							android:layout_height="match_parent"
							android:layout_marginTop="3dp"
							android:layout_weight="1"
							android:text="@string/lesson"
							android:textColor="@color/black"
							android:textSize="12sp" />
					</LinearLayout>
				</LinearLayout>
			</RelativeLayout>
	  
	       /**
			 * 程序主界面
			 */
			public class MainActivity extends AppCompatActivity implements View.OnClickListener {

				private View rollCall;
				private View lesson;
				private TextView tvRollCall;
				private TextView tvLesson;
				private ImageView ivRollCall;
				private ImageView ivLesson;

				@Override
				protected void onCreate(Bundle savedInstanceState) {
					super.onCreate(savedInstanceState);
					setContentView(R.layout.activity_main);
					initView();
					initListener();
					initDataBase();
					showRollCallFragment();
				}

				private void initDataBase() {
					Connector.getDatabase();
				}

				private void initListener() {
					rollCall.setOnClickListener(this);
					lesson.setOnClickListener(this);
				}

				// 初始化控件
				private void initView() {
					rollCall = findViewById(R.id.roll_call);
					lesson = findViewById(R.id.lesson);
					tvRollCall = findViewById(R.id.roll_call_tv);
					tvLesson = findViewById(R.id.lesson_tv);
					ivRollCall = findViewById(R.id.roll_call_img);
					ivLesson = findViewById(R.id.lesson_img);
				}

				// 底部两个按钮点击事件
				@Override
				public void onClick(View v) {
					switch (v.getId()) {
						case R.id.roll_call:
							showRollCallFragment();
							break;
						case R.id.lesson:
							showClassManagerFragment();
							break;
					}
				}

				// 显示点名界面
				private void showRollCallFragment() {
					FragmentManager manager = getSupportFragmentManager();
					Fragment rollCall = manager.findFragmentByTag(RollCallFragment.class.getSimpleName());
					FragmentTransaction transaction = manager.beginTransaction();
					if (rollCall == null) {
						transaction.add(R.id.container, new RollCallFragment(),
								RollCallFragment.class.getSimpleName());
					} else {
						if (rollCall.isHidden()) {
							transaction.show(rollCall);
						} else {
							return;
						}
					}
					Fragment classManager = manager.findFragmentByTag(LessonFragment.class.getSimpleName());
					if (classManager != null && !classManager.isHidden()) {
						transaction.hide(classManager);
					}
					transaction.commit();
					setStatus(true, false);
				}

				// 显示学生花名册界面
				private void showClassManagerFragment() {
					FragmentManager manager = getSupportFragmentManager();
					Fragment classManager = manager.findFragmentByTag(LessonFragment.class.getSimpleName());
					FragmentTransaction transaction = manager.beginTransaction();
					if (classManager == null) {
						transaction.add(R.id.container, new LessonFragment(),
								LessonFragment.class.getSimpleName());
					} else {
						if (classManager.isHidden()) {
							transaction.show(classManager);
						} else {
							return;
						}
					}
					Fragment rollCall = manager.findFragmentByTag(RollCallFragment.class.getSimpleName());
					if (rollCall != null && !rollCall.isHidden()) {
						transaction.hide(rollCall);
					}
					transaction.commit();
					setStatus(false, true);
				}

				// 底部按钮选中字体和图标
				private void setStatus(boolean rollcall, boolean lesson) {
					if (rollcall) {
						tvRollCall.setTextColor(getResources().getColor(R.color.blue_bg));
						ivRollCall.setImageResource(R.drawable.rollcall_on);
					} else {
						tvRollCall.setTextColor(Color.BLACK);
						ivRollCall.setImageResource(R.drawable.rollcall_out);
					}
					if (lesson) {
						tvLesson.setTextColor(getResources().getColor(R.color.blue_bg));
						ivLesson.setImageResource(R.drawable.lesson_on);
					} else {
						tvLesson.setTextColor(Color.BLACK);
						ivLesson.setImageResource(R.drawable.lesson_out);
					}
				}
			}
	  

购买套餐

权益 套餐A 套餐B
完整代码
远程调试 不支持
代码答疑 不支持
价 格 ¥150 ¥300

------转载请注明出处,感谢您对原创作者的支持------

有偿提供技术支持、Bug修复、项目外包、毕业设计、大小作业

Android学习小站

Q Q:1095817610

微信:jx-helu

邮箱:1095817610@qq.com

添加请备注"Android学习小站"