zoukankan      html  css  js  c++  java
  • 家庭记账本1

    今日总结:

    今日写了记账本的主界面以及简单控件交互

    package com.example.a9999;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.content.Intent;
    import android.graphics.ColorSpace;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    
    
    import org.litepal.LitePal;
    import org.litepal.tablemanager.Connector;
    
    public class MainActivity extends AppCompatActivity implements View.OnClickListener {
        @Override
        public void onClick(View v) {
            switch(v.getId()){
                case R.id.btn1:
                    //跳转录入
                    Intent intent=new Intent();
                    intent.setClass(getApplicationContext(), FirstActivity.class);
                    startActivity(intent);
                    break;
                case R.id.btn2:
                    //查看所有账目
                    Intent intent2=new Intent();
                    intent2.setClass(getApplicationContext(), SecondActivity.class);
                    startActivity(intent2);
                    break;
                case R.id.btn3:
                    //查看所有账目
                    Intent intent3=new Intent();
                    intent3.setClass(getApplicationContext(), Third.class);
                    startActivity(intent3);
                    break;
                case R.id.btn4:
                    //删除账目
                    LitePal.deleteAll(jizhang.class);
                    break;
            }
        }
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            initUI();
        }
    
        private void initUI() {
            findViewById(R.id.btn1).setOnClickListener(this);
            findViewById(R.id.btn2).setOnClickListener(this);
            findViewById(R.id.btn3).setOnClickListener(this);
            findViewById(R.id.btn4).setOnClickListener(this);
        }
    }
    <?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:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        tools:context=".MainActivity">
    
      <Button
          android:id="@+id/btn1"
          android:text="录入账单"
          android:layout_width="match_parent"
          android:layout_height="wrap_content">
    
      </Button>
      <Button
          android:id="@+id/btn2"
          android:text="查看全部账目"
          android:layout_width="match_parent"
          android:layout_height="wrap_content">
    
      </Button>
      <Button
          android:id="@+id/btn3"
          android:text="修改账目"
          android:layout_width="match_parent"
          android:layout_height="wrap_content">
    
      </Button>
      <Button
          android:id="@+id/btn4"
          android:text="清空账目"
          android:layout_width="match_parent"
          android:layout_height="wrap_content">
    
      </Button>
    
    
    </LinearLayout>

    难点:不清楚activity的执行方法,第一次使用Android一切都很陌生

    明日计划:继续写记账本,争取年前写完

  • 相关阅读:
    Asp.net MVC FluentHTML and Fluent Interface
    Linux上安装Sybase
    Oracle PL/SQL开发利器Toad应用总结(一)PL/SQL Program基本编写、调试
    ELMAH——可插拔错误日志工具
    用SQLMonitor监视SQL*Net
    如何得到自增id值
    SQL Server ID自增列重新从1开始算起
    加载TreeView并设置复选框
    编程设置最小化、最大化、关闭按钮 相关讨论
    在 VB.NET 编程中使用数组
  • 原文地址:https://www.cnblogs.com/feng747/p/14907399.html
Copyright © 2011-2022 走看看