android算法实现房贷计算器
生活随笔
收集整理的這篇文章主要介紹了
android算法实现房贷计算器
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
說明:最近碰到一個需求,用算法手寫一個房貸計算器,包括等額本金和等額本息,花了一天實現(xiàn)了這個功能,源碼全部貼出來了,計算公式也在代碼里,需要請自取
icon:
step1:
package com.example.myapplication;import android.view.View;import androidx.recyclerview.widget.RecyclerView;/*** Created by kee on 2017/12/25.*/public abstract class BaseRecyclerViewAdapter<VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> implements View.OnClickListener, View.OnLongClickListener {private OnItemClickListener onItemClickListener;private OnItemLongClickListener onItemLongClickListener;@Overridepublic void onBindViewHolder(VH holder, int position) {holder.itemView.setTag(position);holder.itemView.setOnClickListener(this);holder.itemView.setOnLongClickListener(this);}@Overridepublic void onClick(View v) {if (onItemClickListener != null) {onItemClickListener.onItemClick((Integer) v.getTag());}}@Overridepublic boolean onLongClick(View v) {if (onItemLongClickListener != null) {return onItemLongClickListener.onLongClick((Integer) v.getTag());}return false;}public void setOnItemClickListener(OnItemClickListener onItemClickListener) {this.onItemClickListener = onItemClickListener;}public void setOnItemLongClickListener(OnItemLongClickListener onItemLongClickListener) {this.onItemLongClickListener = onItemLongClickListener;}public interface OnItemClickListener {void onItemClick(int position);}public interface OnItemLongClickListener {boolean onLongClick(int position);} }step2:
package com.example.myapplication;import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.List; import androidx.recyclerview.widget.RecyclerView;/*** groups* Created by kee on 2017/8/18.*/public class GroupInfoAdapter extends BaseRecyclerViewAdapter<GroupInfoAdapter.ViewHolder> {private Context mContext;private List<LoanBean> mGroups;private boolean enable;public GroupInfoAdapter(Context context, List<LoanBean> groups) {this.mContext = context;this.mGroups = groups;}@Overridepublic ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_device_group, parent, false);ViewHolder holder = new ViewHolder(itemView);holder.tv_id = (TextView) itemView.findViewById(R.id.tv_id);holder.tv_all = (TextView) itemView.findViewById(R.id.tv_all);holder.tv_year_factor = (TextView) itemView.findViewById(R.id.tv_year_factor);holder.tv_month_factor = (TextView) itemView.findViewById(R.id.tv_month_factor);holder.tv_year_int = (TextView) itemView.findViewById(R.id.tv_year_int);holder.tv_month_int = (TextView) itemView.findViewById(R.id.tv_month_int);holder.tv_li_month = (TextView) itemView.findViewById(R.id.tv_li_month);holder.tv_ben_month = (TextView) itemView.findViewById(R.id.tv_ben_month);holder.tv_all_month = (TextView) itemView.findViewById(R.id.tv_all_month);holder.tv_java_money = (TextView) itemView.findViewById(R.id.tv_java_money);holder.tv_remain_money = (TextView) itemView.findViewById(R.id.tv_remain_money);holder.tv_time = (TextView) itemView.findViewById(R.id.tv_time);holder.tv_all_money = (TextView) itemView.findViewById(R.id.tv_all_money);return holder;}@Overridepublic int getItemCount() {return mGroups == null ? 0 : mGroups.size();}@Overridepublic void onBindViewHolder(ViewHolder holder, int position) {super.onBindViewHolder(holder, position);LoanBean group = mGroups.get(position);holder.tv_id.setText(String.valueOf(group.getId()));holder.tv_all.setText(String.format("%.2f", group.getAll()));holder.tv_year_factor.setText(String.format("%.3f", group.getYearFactor()));holder.tv_month_factor.setText(String.format("%.3f", group.getMonthFactor()));holder.tv_year_int.setText(String.format("%.2f", group.getYearInt()));holder.tv_month_int.setText(String.format("%.2f", group.getMonthInt()));holder.tv_li_month.setText(String.format("%.2f", group.getLiMonth()));holder.tv_ben_month.setText(String.format("%.2f", group.getBenMonth()));holder.tv_all_month.setText(String.format("%.2f", group.getAllMonth()));holder.tv_remain_money.setText(String.format("%.2f", group.getRemainMoney()));holder.tv_java_money.setText(String.format("%.2f", group.getJavaMoney()));holder.tv_time.setText(group.getTime(group.getYear(),group.getMonth(),group.getDay()));holder.tv_all_money.setText(String.format("%.2f", group.getAllMoney()));}class ViewHolder extends RecyclerView.ViewHolder {TextView tv_id, tv_all, tv_year_factor,tv_month_factor, tv_year_int, tv_month_int,tv_li_month, tv_ben_month, tv_all_month,tv_remain_money, tv_java_money,tv_time,tv_all_money;public ViewHolder(View itemView) {super(itemView);}} }step3:
package com.example.myapplication;import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText;import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.core.widget.NestedScrollView; import androidx.fragment.app.FragmentActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView;import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List;public class HelloActivity extends FragmentActivity {double all = 0;double yearFactor = 0;double monthFactor = 0;double yearInt = 0;double monthInt = 0;double liMonth = 0;double benMonth = 0;double allMonth = 0;double remainMoney = 0;double javaMoney = 0;private HashMap<Integer, LoanBean> map;private GroupInfoAdapter mAdapter;private RecyclerView rv_group;private List<LoanBean> list;private EditText et_year_factor;private EditText et_all;private EditText et_year_int;private Button btn_search, btn_search2;private EditText et_year;private EditText et_month;private EditText et_day;@Overrideprotected void onCreate(@Nullable Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);map = new HashMap<>();list = new ArrayList<>();all = 1000000;yearFactor = 0.06;monthFactor = yearFactor / 12;yearInt = 30;monthInt = yearInt * 12;liMonth = remainMoney * monthFactor;benMonth = remainMoney / monthInt;allMonth = liMonth + benMonth;remainMoney = all - javaMoney;for (int i = 0; i < monthInt; i++) {map.put(i, new LoanBean(i, all, ((monthInt+1)*all*monthFactor)/2+all,yearFactor, monthFactor, yearInt, monthInt,(all - ((remainMoney / monthInt) * (i + 1))) * monthFactor,remainMoney / monthInt,(all - ((remainMoney / monthInt) * (i + 1))) * monthFactor + remainMoney / monthInt,all - ((remainMoney / monthInt) * (i + 1)),(remainMoney / monthInt) * (i + 1),(i + 8) / 12 + 2022,(i + 8) % 12,9));}System.out.println(map);if (!list.isEmpty()) {list.clear();}Iterator<Integer> iter = map.keySet().iterator();while (iter.hasNext()) {list.add(map.get(iter.next()));}rv_group = findViewById(R.id.rv_group);et_year_factor = findViewById(R.id.et_year_factor);et_all = findViewById(R.id.et_all);et_year_int = findViewById(R.id.rt_year_int);btn_search = findViewById(R.id.btn_search);btn_search2 = findViewById(R.id.btn_search2);et_year = findViewById(R.id.et_year);et_month = findViewById(R.id.et_month);et_day = findViewById(R.id.et_day);mAdapter = new GroupInfoAdapter(HelloActivity.this, list);rv_group.setLayoutManager(new LinearLayoutManager(HelloActivity.this));rv_group.setAdapter(mAdapter);btn_search.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {String etYearFactorString = et_year_factor.getText().toString();String etAllString = et_all.getText().toString();String etYearIntString = et_year_int.getText().toString();String currentYear = et_year.getText().toString();String currentMonth = et_month.getText().toString();String currentDay = et_day.getText().toString();all = Double.parseDouble(etAllString) * 10000;yearFactor = Double.parseDouble(etYearFactorString) / 100;monthFactor = yearFactor / 12;yearInt = Double.parseDouble(etYearIntString);monthInt = yearInt * 12;liMonth = remainMoney * monthFactor;benMonth = remainMoney / monthInt;allMonth = liMonth + benMonth;remainMoney = all - javaMoney;for (int i = 0; i < monthInt; i++) {map.put(i, new LoanBean(i, all, ((monthInt+1)*all*monthFactor)/2+all,yearFactor, monthFactor, yearInt,monthInt, (all - ((remainMoney / monthInt) * (i + 1))) * monthFactor, remainMoney / monthInt,(all - ((remainMoney / monthInt) * (i + 1))) * monthFactor + remainMoney / monthInt,all - ((remainMoney / monthInt) * (i + 1)),(remainMoney / monthInt) * (i + 1),(i + Integer.parseInt(currentMonth)) / 12 + Integer.parseInt(currentYear),(i + Integer.parseInt(currentMonth)) % 12,Integer.parseInt(currentDay)));}System.out.println(map);if (!list.isEmpty()) {list.clear();}Iterator<Integer> iter = map.keySet().iterator();while (iter.hasNext()) {list.add(map.get(iter.next()));}mAdapter.notifyDataSetChanged();}});btn_search2.setOnClickListener(new View.OnClickListener() {@Overridepublic void onClick(View v) {String etYearFactorString = et_year_factor.getText().toString();String etAllString = et_all.getText().toString();String etYearIntString = et_year_int.getText().toString();String currentYear = et_year.getText().toString();String currentMonth = et_month.getText().toString();String currentDay = et_day.getText().toString();all = Double.parseDouble(etAllString) * 10000;yearFactor = Double.parseDouble(etYearFactorString) / 100;monthFactor = yearFactor / 12;yearInt = Double.parseDouble(etYearIntString);monthInt = yearInt * 12;liMonth = remainMoney * monthFactor;benMonth = remainMoney / monthInt;allMonth = liMonth + benMonth;remainMoney = all - javaMoney;for (int i = 0; i < monthInt; i++) {map.put(i, new LoanBean(i, all,(all * (yearFactor / 12) * Math.pow((yearFactor / 12 + 1), 360) / (Math.pow((yearFactor / 12 + 1), 360) - 1))*monthInt,yearFactor, monthFactor, yearInt,monthInt,all * monthFactor,all * monthFactor * Math.pow((monthFactor + 1), monthInt) / (Math.pow((monthFactor + 1), monthInt) - 1) - all * monthFactor,all * monthFactor * Math.pow((monthFactor + 1), monthInt) / (Math.pow((monthFactor + 1), monthInt) - 1),all - (all * monthFactor * Math.pow((monthFactor + 1), monthInt) / (Math.pow((monthFactor + 1), monthInt) - 1) - all * monthFactor) * (i + 1),(all * monthFactor * Math.pow((monthFactor + 1), monthInt) / (Math.pow((monthFactor + 1), monthInt) - 1) - all * monthFactor) * (i + 1),(i + Integer.parseInt(currentMonth)) / 12 + Integer.parseInt(currentYear),(i + Integer.parseInt(currentMonth)) % 12,Integer.parseInt(currentDay)));}System.out.println(map);if (!list.isEmpty()) {list.clear();}Iterator<Integer> iter = map.keySet().iterator();while (iter.hasNext()) {list.add(map.get(iter.next()));}mAdapter.notifyDataSetChanged();}});} }step4:
package com.example.myapplication;public class LoanBean {/*id 當月月數(shù) 唯一 idall 總金額yearFactor 年利率monthFactor 月利率yearInt 貸款年限monthInt 貸款總期數(shù)liMonth 當月償還利息benMonth 當月償還本金allMonth 當月還款總額remainMoney 剩余未償還本金javaMoney 已償還本金year 還款年份month 還款月份* */private int id;private double all;private double allMoney;private double yearFactor;private double monthFactor;private double yearInt;private double monthInt;private double liMonth;private double benMonth;private double allMonth;private double remainMoney;private double javaMoney;private int year;private int month;private int day;public LoanBean(int id, double all, double allMoney, double yearFactor, double monthFactor, double yearInt, double monthInt, double liMonth, double benMonth, double allMonth, double remainMoney, double javaMoney, int year, int month,int day) {this.id = id;this.all = all;this.allMoney = allMoney;this.yearFactor = yearFactor;this.monthFactor = monthFactor;this.yearInt = yearInt;this.monthInt = monthInt;this.liMonth = liMonth;this.benMonth = benMonth;this.allMonth = allMonth;this.remainMoney = remainMoney;this.javaMoney = javaMoney;this.year = year;this.month = month;this.day = day;}public double getAllMoney() {return allMoney;}public void setAllMoney(double allMoney) {this.allMoney = allMoney;}public int getId() {return id;}public void setId(int id) {this.id = id;}public double getAll() {return all;}public void setAll(double all) {this.all = all;}public double getYearFactor() {return yearFactor;}public void setYearFactor(double yearFactor) {this.yearFactor = yearFactor;}public double getMonthFactor() {return monthFactor;}public void setMonthFactor(double monthFactor) {this.monthFactor = monthFactor;}public double getYearInt() {return yearInt;}public void setYearInt(double yearInt) {this.yearInt = yearInt;}public double getMonthInt() {return monthInt;}public void setMonthInt(double monthInt) {this.monthInt = monthInt;}public double getLiMonth() {return liMonth;}public void setLiMonth(double liMonth) {this.liMonth = liMonth;}public double getBenMonth() {return benMonth;}public void setBenMonth(double benMonth) {this.benMonth = benMonth;}public double getAllMonth() {return allMonth;}public void setAllMonth(double allMonth) {this.allMonth = allMonth;}public double getRemainMoney() {return remainMoney;}public void setRemainMoney(double remainMoney) {this.remainMoney = remainMoney;}public double getJavaMoney() {return javaMoney;}public void setJavaMoney(double javaMoney) {this.javaMoney = javaMoney;}public int getYear() {return year;}public void setYear(int year) {this.year = year;}public int getMonth() {return month;}public void setMonth(int month) {this.month = month;}public int getDay() {return day;}public void setDay(int day) {this.day = day;}public String getTime(int year, int month,int day) {if (month==0){month=12;}return year+"年"+month+"月"+day+"日";}}step5:
<?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout 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"tools:context=".MainActivity"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"><LinearLayoutandroid:id="@+id/ll_top"android:layout_width="match_parent"android:layout_height="wrap_content"android:orientation="vertical"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="40dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="貸款年利率"android:textSize="12sp" /><EditTextandroid:id="@+id/et_year_factor"android:layout_width="120dp"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="6"android:textSize="13sp" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_toRightOf="@+id/et_year_factor"android:text="%" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="40dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="貸款總金額"android:textSize="12sp" /><EditTextandroid:id="@+id/et_all"android:layout_width="120dp"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="100"android:textSize="13sp" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_toRightOf="@+id/et_all"android:text="W" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="40dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="貸款年限"android:textSize="12sp" /><EditTextandroid:id="@+id/rt_year_int"android:layout_width="120dp"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="30"android:textSize="13sp" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_toRightOf="@+id/rt_year_int"android:text="年" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="40dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="首次還款月份"android:textSize="12sp" /><EditTextandroid:id="@+id/et_year"android:layout_width="120dp"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="2022"android:textSize="13sp" /><TextViewandroid:id="@+id/tv_year"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_toRightOf="@+id/et_year"android:text="年" /><EditTextandroid:id="@+id/et_month"android:layout_width="30dp"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_toRightOf="@+id/tv_year"android:text="8"android:textSize="13sp" /><TextViewandroid:id="@+id/tv2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_toRightOf="@+id/et_month"android:text="月" /><EditTextandroid:id="@+id/et_day"android:layout_width="30dp"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_toRightOf="@+id/tv2"android:text="9"android:textSize="13sp" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_toRightOf="@+id/et_day"android:text="日" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="40dp"><Buttonandroid:id="@+id/btn_search"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="25dp"android:text="計算等額本金" /><Buttonandroid:id="@+id/btn_search2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_toRightOf="@+id/btn_search"android:layout_centerVertical="true"android:layout_marginLeft="25dp"android:text="計算等額本息" /></RelativeLayout></LinearLayout><androidx.recyclerview.widget.RecyclerViewandroid:id="@+id/rv_group"android:layout_width="match_parent"android:layout_height="match_parent"android:layout_below="@+id/ll_top"android:fadingEdge="none"android:listSelector="@android:color/transparent"android:verticalSpacing="10dp" /></RelativeLayout> </androidx.constraintlayout.widget.ConstraintLayout>step6:
<?xml version="1.0" encoding="utf-8"?> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:fresco="http://schemas.android.com/tools"android:layout_width="match_parent"android:layout_height="wrap_content"android:layout_margin="8dp"android:background="@android:color/white"app:cardCornerRadius="4dp"app:cardPreventCornerOverlap="false"app:cardUseCompatPadding="true"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center_vertical"android:orientation="vertical"android:padding="8dp"><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="當前期數(shù)"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_id"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="貸款總金額"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_all"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="年利率"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_year_factor"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="月利率"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_month_factor"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="貸款年限"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_year_int"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="貸款總期數(shù)"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_month_int"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="貸款本息總額"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_all_money"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textColor="@android:color/holo_red_dark"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="當月償還利息"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_li_month"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="當月償還本金"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_ben_month"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="當月還款總額"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_all_month"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textColor="@android:color/holo_red_dark"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="剩余未償還本金"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_remain_money"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="已償還本金"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_java_money"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="30dp"><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerVertical="true"android:layout_marginLeft="12dp"android:text="還款日期"android:textSize="12sp" /><TextViewandroid:id="@+id/tv_time"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerInParent="true"android:text="@string/app_name"android:textSize="13sp" /><TextViewandroid:layout_width="match_parent"android:layout_height="0.1dp"android:layout_alignParentBottom="true"android:layout_centerHorizontal="true"android:layout_marginLeft="10dp"android:layout_marginRight="10dp"android:background="@android:color/darker_gray" /></RelativeLayout></LinearLayout></androidx.cardview.widget.CardView>end
總結(jié)
以上是生活随笔為你收集整理的android算法实现房贷计算器的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python读取中文Excel问题解决
- 下一篇: 实现压缩文件和加密