<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.administrator.married.MainActivity"
android:orientation="vertical"
android:weightSum=""> <TextView
android:text="性别:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40dp"
android:textColor="@android:color/black"
android:id="@+id/sex" /> <EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems=""
android:id="@+id/edtSex"
android:hint="(输入性别)"
android:singleLine="false" /> <TextView
android:text="年龄:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40dp"
android:textColor="@android:color/black"
android:id="@+id/age" /> <EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems=""
android:id="@+id/edtAge"
android:hint="(输入年龄)" /> <Button
android:text="确定"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/btnOk"
android:layout_gravity="center_horizontal"
android:textSize="40dp"
android:elevation="24dp" /> <TextView
android:text="@string/result"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40dp"
android:textColor="@android:color/black"
package com.example.administrator.married;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.*; public class MainActivity extends AppCompatActivity { EditText mEdtSex,mEdtAge;
TextView mTxtR;
Button mBtnOk; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); mEdtSex = (EditText)findViewById(R.id.edtSex);
mEdtAge = (EditText)findViewById(R.id.edtAge);
mTxtR = (TextView)findViewById(R.id.txtR);
mBtnOk = (Button)findViewById(R.id.btnOk); mBtnOk.setOnClickListener(btnOkOnClick);
} private View.OnClickListener btnOkOnClick = new View.OnClickListener(){
public void onClick(View v){
String strSex=mEdtSex.getText().toString();
int iAge=Integer.parseInt(mEdtAge.getText().toString()); String strSug = getString(R.string.result);
if(strSex.equals("男")){
if(iAge<28){
strSug+="池哥告诉你:还不急";
}
else if(iAge>33){
strSug+="池哥告诉你:赶快结婚!";
}
else{
strSug+="池哥告诉你:开始找对象!";
}
}
else{
if(iAge<25){
strSug+="池哥告诉你:还不急";
}
else if(iAge>30){
strSug+="池哥告诉你:赶快结婚!";
}
else{
strSug+="池哥告诉你:开始找对象!";
}
} mTxtR.setText(strSug);
}
};
}

        android:id="@+id/txtR" />

</LinearLayout>

9-第一个app项目的更多相关文章

  1. 学习方法和阶段介绍 、 iOS界面开发引入 、 构造第一个App 、 视图控制器和视图 、 控件与事件 、 InterfaceBuilder

    1 创建并运行第一个App 1.1 问题 使用Xcode创建一个App项目,该应用实现功能在界面上显示Hello World标签,在模拟器中的运行结果如图-1所示: 图-1 1.2 方案 分析图-1, ...

  2. 行内人解读开发一个App需要多少钱?

    对于很多互联网的创业者来说,评估前期的创业成本是很重要的.在这几年的创业大潮中,伴随着“互联网+”和“互联网思维”的普及,很多创业项目选择了开发app作为创业项目的载体.在我接触到的很多创业者,找Ap ...

  3. Android studio教程:[1] 创建app项目

    Android studio作为面市不久的安卓开发工具,越来越受到大家的喜爱,这里我将介绍如何在Android studio中创建一个APP项目,并在以后经验中介绍其他有关Android studio ...

  4. 发现了一个App拉新工具:免填邀请码

    去年公司开始着手开发一个App项目,从调研到开发完成,前前后后历时快半年(没少加班),目前产品已经上架了各个应用市场,名字就不提了,省得说我打广告.今年开年说要开始做冷启动了,大家都知道,这才是最苦逼 ...

  5. 一个App项目设计开发完整流程

    作为一个PHP程序猿想转行APP开发可不是件容易的事情,话说隔行如隔山,这隔着一层语言也是多东西需要学习啊,一直对APP开发很感兴趣,最近请教了几个做移动开发的朋友,看了很多的资料,决定把自己学到的东 ...

  6. 用weex create 创建app项目 报 ERROR in index.web.js from UglifyJs 错误!

    用weex create创建一个APP项目,安装依赖后运行报 这个是package.json index.web.js 在dist目录下是build时生成的. 上面的答案没有给大家细节,不好意思致歉下 ...

  7. Android Studio 1.0.2项目实战——从一个APP的开发过程认识Android Studio

    Android Studio 1.0.1刚刚发布不久,谷歌紧接着发布了Android Studio 1.0.2版本,和1.0.0一样,是一个Bug修复版本.在上一篇Android Studio 1.0 ...

  8. Android项目实战(二十二):启动另一个APP or 重启本APP

    一.启动另一个APP 目前公司项目需求,一个主APP,需要打开某些小APP,这些小APP是整合了Unity的,但是还是android程序(所有小APP的包名是已知的). 以前没做过,查询了一下实现方法 ...

  9. django学习笔记二:一个项目多个App项目搭建

    django充许在一个项目中存在多个app,如一个大门户网站中可以包含论坛,新闻等内容,其中每一个模块称之为一个App,也可以理解为一个个独立的小型项目最终集成在一个门户网站中最终呈现给用户 本次测试 ...

随机推荐

  1. hdu1290

    由二维的切割问题可知,平面切割与线之间的交点有关,即交点决定射线和线段的条数,从而决定新增的区域数. 当有n-1个平面时,切割的空间数为f(n-1).要有最多的空间数.则第n个平面需与前n-1个平面相 ...

  2. UVA 11294 - Wedding(Two-Set)

    UVA 11294 - Wedding 题目链接 题意:有n对夫妻,0号是公主.如今有一些通奸关系(男男,女女也是可能的)然后要求人分配在两側.夫妻不能坐同一側.而且公主对面一側不能有两个同奸的人,问 ...

  3. &quot;浪潮杯&quot;第六届ACM山东省省赛山科场总结

    从空间拷过来的.尽管已经过去一个月了.记忆犹新 也算是又一次拾起这个blog Just begin 看着一群群大牛还有队友男神的省赛总结都出了 我最终也耐不住寂寞 来做个流水账抒抒情好了 第一次省赛 ...

  4. MYSQL主从复制搭建及切换操作(GTID与传统)

    结构如下: MYSQL主从复制方式有默认的复制方式异步复制,5.5版本之后半同步复制,5.6版本之后新增GTID复制,包括5.7版本的多源复制. MYSQL版本:5.7.20 操作系统版本:linux ...

  5. xBIM 基础16 IFC的空间层次结构

    系列目录    [已更新最新开发文章,点击查看详细]  本篇介绍如何从文件中检索空间结构.IFC中的空间结构表示层次结构的嵌套结构,表示项目,站点,建筑物,楼层和空间.如果您查看IFC文档, 您会发现 ...

  6. 在CentOS下安装tomcat并配置环境变量(改默认端口8080为8081)

    不多说,直接上干货! 第一步:下载tomcat压缩包 http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.73/bin/ 第二步:上传tomcat压 ...

  7. Windows常见软件故障及解决方案

    HM NIS Edit: HM NIS Edit 新建程序向导无效,提示“Please specify the setup lang” 说明 NSIS 安装不对.解决方案有二种: 1. 重装 NSIS ...

  8. MyBatis数据持久化(一)准备工作

    MyBatis简介 mybatis的前生是ibatis,它是一款非常优秀的java持久层框架,所有sql语句写在配置文件中,和另外一款比较知名的orm框架hibernate比起来显得更加小巧灵活,也是 ...

  9. avalon 双工绑定以及一个按钮多个事件

    <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server">    ...

  10. hiho 1604 - 股票价格,思维题

    题目链接 题目大意 小Hi最近在关注股票,为了计算股票可能的盈利,他获取了一只股票最近N天的价格A1~AN. 在小Hi的策略中,每天可以在下列三种操作中选取一种: 1.什么也不做: 2.按照当天的价格 ...