喜闻乐见也是我最会的布局阶段

    <EditText    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:layout_marginTop="150dp"    android:hint="@string/EditTextname"    android:textColorHint="#ff3"    android:gravity="center"    android:textColor="#ff0033"    android:id="@+id/shuru"/>

        <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content">            <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_weight="1"            android:text="@string/button1"            style="@style/text"            android:onClick="onClick"            android:id="@+id/button1"/>            <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_weight="1"            android:text="@string/button2"            style="@style/text"            android:id="@+id/button2"/>

        </LinearLayout>        <TextView        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:text="@string/TextViewname"        android:gravity="center"        android:id="@+id/show"        android:textColor="#ff0033"        style="@style/text"        android:onClick="onClick"/>    </LinearLayout>

string.xml文件的实现

    <resources>    <string name="app_name">Activity</string>    <string name="button1">进入评估</string>    <string name="button2">退出</string>    <string name="EditTextname">请输入姓名</string>    <string name="TextViewname">评估结果</string>    <string name="button3">有</string>    <string name="button4">没有</string>

    </resources>

styles.xml文件的实现
    <resources>

    <!-- Base application theme. -->    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">        <!-- Customize your theme here. -->        <item name="colorPrimary">@color/colorPrimary</item>        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>        <item name="colorAccent">@color/colorAccent</item>    </style>    <style name="text">        <item name="android:textSize">20sp</item>    </style>

    </resources>

然后再弄一个布局

    <TextView        android:layout_width="match_parent"        android:layout_height="wrap_content"        android:gravity="center"        android:textColor="#ff0033"        android:id="@+id/show"/>        <LinearLayout        android:layout_width="match_parent"        android:layout_height="wrap_content">            <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_weight="1"            android:text="@string/button3"            style="@style/text"            android:onClick="onClick"            android:id="@+id/button3"/>            <Button            android:layout_width="0dp"            android:layout_height="wrap_content"            android:layout_weight="1"            android:text="@string/button4"            style="@style/text"            android:onClick="onClick"            android:id="@+id/button4"/>

        </LinearLayout>

    </LinearLayout>

代码实现参考如下

public class  {

    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.activity_tiaozhuan);        Intent intent = getIntent();        TextView tvshow=(TextView)findViewById(R.id.show);        EditText etshuru=(EditText)findViewById(R.id.shuru);        String name=intent.getStringExtra("name");        tvshow.setText(name);    }    public void onClick(View view){        switch (view.getId()){            case R.id.button1:            case R.id.button2:                enter();                break;        }    }

    private void enter() {        EditText etshuru=(EditText)findViewById(R.id.shuru);        String name =etshuru.getText().toString();        Intent intent=new Intent(this,JiemianActivity.class);        intent.putExtra("name",name+"同学:学习Android有没有信心?");        startActivity(intent);

    }}
public class  {

    @Override    protected void onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentView(R.layout.jiemian2);        Intent intent = getIntent();        TextView tvshow=(TextView)findViewById(R.id.show);        String name=intent.getStringExtra("name");        tvshow.setText(name);    }    public void onClick(View view){        switch (view.getId()){            case R.id.button3:                ruturn();                break;            case R.id.button4:                ruturn2();                break;        }    }

    private void ruturn() {        Intent intent=new Intent(this,TiaozhuanActivity.class);        Button btnbutton3=(Button)findViewById(R.id.button3);        String name=btnbutton3.getText().toString();        intent.putExtra("name","评估内容返回为:"+name);        startActivity(intent);    }

    private void ruturn2() {        Intent intent=new Intent(this,TiaozhuanActivity.class);        Button btnbutton4=(Button)findViewById(R.id.button4);        String name=btnbutton4.getText().toString();        intent.putExtra("name","评估内容返回为:"+name);        startActivity(intent);    }

}

最后的最后

作业的布局是自力更生

然而程序的实现却是一脸懵逼

参考了已有同学的代码

改造之后才有了现在的作业

发现代码的实现还有很大的问题

发现很多东西只是看的熟悉

然而根本不知道具体左右

日后的重点要弱化界面而要尽力弄懂程序的实现

转载于:https://www.cnblogs.com/vouil/p/6728582.html

深入Activity的作业完成相关推荐

  1. android 启动过程详解,Activity的启动过程详解(基于Android10.0)

    一.概述 话说Android中有四大组件:Activity.Service.BroadcastReceiver.ContentProvider.咱们最常接触也是用户直接感受到的便是Activity了, ...

  2. 物料分类账业务配置及操作手册

    物料分类账业务配置及操作手册 物料分类账业务配置及操作手册 Overview 业务说明 物料分类账的主要作用在于将实际成本和标准成本的差异分摊到库存和销售成本中,从而实现差异在实际的使用者中进行分摊, ...

  3. [SAP Dictionary]

    Words    Chinese (foreign) exchange gain 汇兑收益 (foreign) exchange loss 汇兑损失 (investment) support allo ...

  4. 第二次作业——Service、Listview与ACtivity参数传递

    转载请注明出处:http://blog.csdn.net/qq347198688/article/details/52914407 本文出自[何嘉龙的博客] 前言 在实战之前呢,我想跟大家唠唠几句,本 ...

  5. 代写SOFTENG 370 Operating Systems课设、代做C/C++ 留学生作业、代写c/c++代码、代写C/C++编程作业...

    代写SOFTENG 370 Operating Systems课设.代做C/C++ 留学生作业.代写c/c++代码.代写C/C++编程作业 SOFTENG 370 Operating Systems ...

  6. Activity中的任务和返回站

    今天继续来任务和返回栈,应用通常包含多个Activity,任务是指在执行特定作业时与用户交互的一系列Activity,这些Activity按照各自的打开顺序排列在堆栈中. 后天可以同时运行多个任务,但 ...

  7. KSS2-成本中心作业价格分割(错误!!!)

    将成本中心的成本分割到不同的作业. 计算出来的费用金额应该等于成本中心费用报表中的金额,如果出现计算出来的费用金额是每月的累计数,需要调整控制范围的版本(TCODE:OKEQ)中年度设置中的价格计算的 ...

  8. android 实训的背景,Android实训项目作业.doc

    Android实训项目作业 2-1用整型数计算两个数的和2 2-7排列任意4个数的顺序,按从小到大顺序输出2 2.1编写显示下列图形的程序.2 3.1编写程序,当点击按钮命令后,页面标题及文本组件的文 ...

  9. 2017-2018-2 20179215 《密码与安全新技术》第5周作业

    2017-2018-2 20179215 <密码与安全新技术>第5周作业 课程:<密码与安全新技术> 班级: 1792 姓名: 袁琳 学号:20179215 上课教师:谢四江 ...

最新文章

  1. 【Android】FragmentTabHost实现底部Tab菜单选项
  2. 彩色图像到灰度转换 常见方法汇总与对比
  3. 2015年二级c语言真题及答案,2015年计算机二级C语言测试题及答案(4)
  4. python读取文件夹下文件
  5. Django 无法添加新字段,django.db.utils.OperationalError: (1050, Table app already exists)
  6. 不同系统平台下Java默认的安装路径
  7. 漫画:什么是ZooKeeper
  8. 机器学习笔记(四)---- 逻辑回归的多分类
  9. java web 密码修改,【67彩手机客户端】-平台网站
  10. Java 并发编程 基础
  11. 脉脉第一干货贴,互联网职场那点事,关于面试、绩效、晋升、职业规划。
  12. 华为Mate 30 Pro前面板曝光:双曲面设计 几乎全是屏
  13. shell通过sshpass远程ssh执行命令
  14. 【从C到C++学习笔记】bool类型/const限定符/#define//结构体对齐
  15. C语言基础选择题100道(附答案)02
  16. 梅特勒托利多xk3124电子秤说明书_梅特勒托利多电子秤校正标定方法
  17. 多元线性回归矩阵求导
  18. lg相乘公式_lg的运算法则是什么
  19. TensorFlow中的小知识:tf.flags.DEFINE_xxx()
  20. Istio 1.4 部署指南

热门文章

  1. vue项目中app.vue 、main.js和 index.html的关联
  2. Linux系统CentOS下mysql的安装日志
  3. 基于visual Studio2013解决面试题之1002公共子串
  4. 从人的角度分析进销存管理的需求
  5. docker系列之file基本操作
  6. Linux 常见目录与区别
  7. [笔记]NumPy基础操作
  8. Git图文教程:从零到上传GitHub项目
  9. 第二篇:白话tornado源码之待请求阶段
  10. Debian中几个bash初始化脚本使用区别--【转载】