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,也可以理解为一个个独立的小型项目最终集成在一个门户网站中最终呈现给用户 本次测试 ...
随机推荐
- string 简单实现
namespace ss{ class string { friend ostream& operator <<(ostream&, const string&); ...
- 3、Android中Activity的跳转
1.创建project file->new->android application 依次填入应用名称.project名.包名 在project文件夹下找到src/com. ...
- swift算法手记-7
@IBAction func compute(sender: AnyObject) { // 19*x^7-31*x^5+16*x^2+7*x-90=0 // newton迭代法求一元方程的解,最大求 ...
- Windows环境下通过Git来管理自己的Android代码
前面已经介绍了在Windows下使用git工具来下载Android的源代码,Windows环境下通过Git得到Android源代码,这里记录我使用git工具来管理我自己的代码,git是一种分布式的项目 ...
- Android圆形图片--自己定义控件
Android圆形图片控件效果图例如以下: 代码例如以下: RoundImageView.java package com.dxd.roundimageview; import android.con ...
- [JZOJ 5893] [NOIP2018模拟10.4] 括号序列 解题报告 (Hash+栈+map)
题目链接: https://jzoj.net/senior/#main/show/5893 题目: 题解: 考虑暴力怎么做,我们枚举左端点,维护一个栈,依次加入元素,与栈顶元素和栈内第二个元素相同时弹 ...
- asp.net DataTables
无聊做一个,但是还是留下一些疑惑: 在控件中加入例如编辑,删除之类的按钮,而不是以行内元素呈现. 真实分页的实现方法. 要是有知道的朋友,希望指点一二. 下面只实现的功能: 隐藏列 冻结列 分页 列排 ...
- 固定执行计划-SQL PROFILE手工绑定
固定(稳定)执行计划 你的应用的功能时快时慢,变化比较大,功能的性能能够保持一种稳定的状态,ORACLE 固定执行计划,采用以下这几种方式 oracle 9i使用 Outline oracle 10g ...
- ZBrush中Zproject与SubTool的综合应用
在ZBrush中有很多工具也需要配合子物体工具来使用,如笔刷中的Zproject(投射笔刷)就需要子物体工具来配合使用,本文将讲解一下它的用法. 1. 首先创建一个平面,在Tool(工具)面板中选择P ...
- 运维派 企业面试题6 防dos攻击
Linux运维必会的实战编程笔试题(19题) 企业实战题6:请用至少两种方法实现! 写一个脚本解决DOS攻击生产案例 提示:根据web日志或者或者网络连接数,监控当某个IP并发连接数或者短时内PV达到 ...