家庭记账本APP开发准备(二)
今天学习了选项卡,为记账本的分类做了准备。主登录界面进行了优化,但仍未实现各个组件之间的跳转。
选项卡
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<TabHost 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:id="@android:id/tabhost"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TabWidget
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@android:id/tabs" ></TabWidget>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@android:id/tabcontent"
></FrameLayout>
</LinearLayout> </TabHost>
tab1.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/left"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/bg"/> </LinearLayout>
tab2.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:id="@+id/right"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/img"/> </LinearLayout>
MainActivity.java
package com.example.xuanxiang; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.TabHost; public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TabHost tabHost =(TabHost) findViewById(android.R.id.tabhost);
tabHost.setup();//初始化 添加标签页
LayoutInflater inflater =LayoutInflater.from(this);
inflater.inflate(R.layout.tab1,tabHost.getTabContentView());
inflater.inflate(R.layout.tab2,tabHost.getTabContentView());
tabHost.addTab(tabHost.newTabSpec("tab1").setIndicator("选项一").setContent(R.id.left));
tabHost.addTab(tabHost.newTabSpec("tab2").setIndicator("选项二").setContent(R.id.right));
}
}
优化美化后的主界面..........
家庭记账本APP开发准备(二)的更多相关文章
- 家庭记账本APP开发准备(三)
单选框(RadioButton) 通过设置单选框,可以将非此即彼的问题进行解决,成功学会并应用了手机端单项选择框; 复选框(CheckBox) 学习复选框是为了给使用软件的人更多的选择,在其他选择框后 ...
- 家庭记账本APP开发准备(一)
1.登录界面 通过学习比较 登录界面采用线性布局(LinearLayout) 下面是相关源码 activity_main.xml ?xml version="1.0" encodi ...
- 简单记账本APP开发一
在对Android的一些基础的知识有了一定了解,以及对于AndroidStudio的如何使用有了 一定的熟悉后,决定做一个简单的记账本APP 开发流程 1.记账本的页面 2.可以添加新的账目 (一)页 ...
- 进度1_家庭记账本App
今天完成了昨天的初步构想,详细介绍见上一篇博客,具体项目结构和案例如下: MainActivity.java: package com.example.familybooks; import andr ...
- 家庭版记账本app开发完成
经过这几天关于android的相关学习,对于家庭版记账本app以及开发结束. 实现的功能为:用户的注册.登录.添加支出账单.添加收入账单.显示所有的该用户的账单情况(收入和支出).生产图表(直观的显示 ...
- 简单记账本APP开发二
今天主要是进行了适配器的编写,数据库的创建以及对完善了业务逻辑,简单的APP到此已经通过测试可以使用.
- 家庭版记账本app开发之关于(数据库查找出数据)圆饼图的生成
这次完成的主要的怎样从数据库中调出数据.之后通过相关的数据,生成想要的圆饼图.以方便用户更加直观的看见关于账本的基本情况. 在圆饼图生成中用到了一些外部资源 具体的import如下: import c ...
- 家庭记账本web开发
这个系统的整体结构: GitHub:https://github.com/lq1998lq/Test.git com.action包: package com.action; import java. ...
- 进度4_家庭记账本App
在上一个博客中,我学习了用Fragment进行数据的传值,但是出现了好多问题,我通过百度查阅资料发现fregment在进行数值传输的时候有的语法不能使用,并且不方便的进行数据库的使用,所以我在原来的家 ...
随机推荐
- java学习第六天2020/7/11
一. 今天先是对昨天的知识进行了练习: package 数组; import java.util.Random; import java.util.Arrays; public class 随机数排序 ...
- MCMC随机采样
1 MCMC蒙特卡罗方法 作为一种随机采样方法,马尔科夫链蒙特卡罗(Markov Chain Monte Carlo,以下简称MCMC)在机器学习,深度学习以及自然语言处理等领域都有广泛的应用,是很多 ...
- How to use the functions of apply and call
Although apply and call can implement same function. However, there is a litter different between ...
- nginx配置文件服务器——带说明
需求: 搭建一个文件服务器,提供指定软件下载,在访问文件服务器下载软件时,在访问的主页上要有对应的软件使用.安装等说明(本来是可以搞一个readme的,但这个在文件服务器上要下载还要打开,还不如直接显 ...
- 《Head First 设计模式》:装饰者模式
正文 一.定义 装饰者模式动态地将责任(功能)附加到对象上.若要扩展功能,装饰者提供了比继承更有弹性的替代方案. 要点: 装饰者和被装饰者有相同的超类型. 可以用一个或多个装饰者包装一个对象. 既然装 ...
- 架构师都该懂的 CAP 定理
面对可能出现的网络延迟,不可预估的请求流量等情况,设计一个分布式系统,我们通常围绕系统高可用,数据一致性的目标去规划和实现,想要完全实现这个目标,却并非易事.由此,分布式系统领域诞生了一个基本定理,即 ...
- 使用Azure DevOps Pipeline实现.Net Core程序的CI
上次介绍了Azure Application Insights,实现了.net core程序的监控功能.这次让我们来看看Azure DevOps Pipeline功能.Azure DevOps Pip ...
- 团队转型,Scrum与DevOps要如何取舍?
团队在践行敏捷的过程中,会有多种选择:Scrum.XP.Kanban.Crystal.精益生产.规模化敏捷等,其中最流行的敏捷开发方法当属Scrum.正因如此,大部分人对其产生了刻板印象:认为敏捷就是 ...
- Elasticsearch7.X ILM索引生命周期管理(冷热分离)
Elasticsearch7.X ILM索引生命周期管理(冷热分离) 一.“索引生命周期管理”概述 Elasticsearch索引生命周期管理指:Elasticsearch从设置.创建.打开.关闭.删 ...
- lambda之美
github源码 大前提:jdk8 允许lambda表达式 最好在maven中加入 <properties> <java.version>1.8</java.vers ...