9-第一个app项目
<?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项目的更多相关文章
- 学习方法和阶段介绍 、 iOS界面开发引入 、 构造第一个App 、 视图控制器和视图 、 控件与事件 、 InterfaceBuilder
1 创建并运行第一个App 1.1 问题 使用Xcode创建一个App项目,该应用实现功能在界面上显示Hello World标签,在模拟器中的运行结果如图-1所示: 图-1 1.2 方案 分析图-1, ...
- 行内人解读开发一个App需要多少钱?
对于很多互联网的创业者来说,评估前期的创业成本是很重要的.在这几年的创业大潮中,伴随着“互联网+”和“互联网思维”的普及,很多创业项目选择了开发app作为创业项目的载体.在我接触到的很多创业者,找Ap ...
- Android studio教程:[1] 创建app项目
Android studio作为面市不久的安卓开发工具,越来越受到大家的喜爱,这里我将介绍如何在Android studio中创建一个APP项目,并在以后经验中介绍其他有关Android studio ...
- 发现了一个App拉新工具:免填邀请码
去年公司开始着手开发一个App项目,从调研到开发完成,前前后后历时快半年(没少加班),目前产品已经上架了各个应用市场,名字就不提了,省得说我打广告.今年开年说要开始做冷启动了,大家都知道,这才是最苦逼 ...
- 一个App项目设计开发完整流程
作为一个PHP程序猿想转行APP开发可不是件容易的事情,话说隔行如隔山,这隔着一层语言也是多东西需要学习啊,一直对APP开发很感兴趣,最近请教了几个做移动开发的朋友,看了很多的资料,决定把自己学到的东 ...
- 用weex create 创建app项目 报 ERROR in index.web.js from UglifyJs 错误!
用weex create创建一个APP项目,安装依赖后运行报 这个是package.json index.web.js 在dist目录下是build时生成的. 上面的答案没有给大家细节,不好意思致歉下 ...
- 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 ...
- Android项目实战(二十二):启动另一个APP or 重启本APP
一.启动另一个APP 目前公司项目需求,一个主APP,需要打开某些小APP,这些小APP是整合了Unity的,但是还是android程序(所有小APP的包名是已知的). 以前没做过,查询了一下实现方法 ...
- django学习笔记二:一个项目多个App项目搭建
django充许在一个项目中存在多个app,如一个大门户网站中可以包含论坛,新闻等内容,其中每一个模块称之为一个App,也可以理解为一个个独立的小型项目最终集成在一个门户网站中最终呈现给用户 本次测试 ...
随机推荐
- scanf正则表达式
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> void main() { ] = ...
- .net core 实现npoi导出
Nuget 安装 NPOI 2.4.1 工作时间写着测试玩玩 public void ExportDataToExcel() { var workbook = new HSSFWorkbook(); ...
- 关于Spring的69个面试问答——终极列表 (转)
这篇文章总结了一些关于Spring框架的重要问题,这些问题都是你在面试或笔试过程中可能会被问到的.下次你再也不用担心你的面试了,Java Code Geeks这就帮你解答. 大多数你可能被问到的问题都 ...
- POJ 1273 Drainage Ditches【最大流】
题意:给出起点是一个池塘,M条沟渠,给出这M条沟渠的最大流量,再给出终点是一条河流,问从起点通过沟渠最多能够排多少水到河流里面去 看的紫书的最大流,还不是很理解,照着敲了一遍 #include< ...
- Failed to connect to server
设置LR浏览器代理解决Failed to connect to server,Connection timed out问题. 虚拟机中,接口测试简单的Get请求,一直提示Failed to conne ...
- nginx的location 匹配的规则问题
正则解释: ~ #匹配一个正则匹配,区分大小写~* #匹配一个正则,不区分大小写^~ #普通字符匹配,如果该选择匹配不匹配别的选项,一般用来匹配目录= #精确匹配 匹配案例:location = / ...
- 视图层 view
视图层是 Django 处理请求的核心代码层,我们大多数 Python 代码都集中在这一层面.它对外接收用户请求,对内调度模型层和模版层,统合数据库和前端,最后根据业务逻辑,将处理好的数据,与前端结合 ...
- 线段树(segment tree )
http://www.cnblogs.com/TenosDoIt/p/3453089.html 写的非常好! 很多学校流行一种比较的习惯.老师们很喜欢询问,从某某到某某当中,分数最高的是多少. 这让很 ...
- NodeJS学习笔记 (1)资源压缩-zlib(ok)
原文: https://github.com/chyingp/nodejs-learning-guide/blob/master/README.md 自己的跟进学习: 概览 做过web性能优化的同学, ...
- Vue中两种跳转方式
第一种:通过标签跳转,<router-link></router-link> 第二种:通过js跳转,定义点击事件进行跳转