BMI如何怎么计算BMI?

BMI計算(身體質量指數)
&&&&&&&&&&&&&&&&
理想體重計算
&&&&&&&&&&&&&&&&&&
◎無論男女,身材要如何變美這檔事,一直都是許多人關心的話題,但因每個人的生活方式
和飲食習慣都不相同,想要美好的身型,也需配合日常規律之作息、餐飲均衡與適當運動,
更得戒除不良的生活型態和壞習慣,才能讓自己持續保持著良好的體態。 ( 線上BMI計算↓)
Body Mass Index身體質量指數 = 體重(公斤) / 身高2(公尺2)
人體健康最理想的數值被世界衛生組織認定為:22
身體質量指數
<font color="#.5
≦ BMI <24
<font color="#
≦ BMI <27
<font color="#
≦ BMI <30
<font color="#
≦ BMI <35
&&&&&&&&&&&&&&&&
●請輸入身高→
●請輸入體重→
身體質量指數
BMI 值為:
&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&
~本單元資料數值僅供參考,網友個人身心健康方面問題宜請教醫師或相關專業人員~
&&&&&&&&&&&&&&&&&&&&&&
?Copyright
* Tk-studio All Rights Reserved.&
&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&>&&>&BMI 计算法
Number of shares: {0}
BMI 计算法
产品与品牌
雀巢在社会
营养与健康
nestle-monitoring-loaded【bmi计算公式是怎样的】_百度知道
【bmi计算公式是怎样的】
啊宝kN2畐F1
啊宝kN2畐F1
采纳数:62
获赞数:192
擅长:暂未定制
  bmi计算公式:
  BMI具体计算方法是以体重的千克数除以身高平方(米为单位)。
  其公式为:体质指数(BMI)=体重(千克)/身高(米)2
  体重指数:19以下 体重偏低
  19-25 健康体重
  25-30 超重
  30-39 严重超重
  40及40以上极度超重
  体重指数(BMI--Body Mass Index)
  是评估身高体重比例的参考指数。它的计算公式为:体重(kg)除以身高(m)的平方(BMI =公斤/m2)
  BMI指数(Body Mass
Index)即身体质量指数,是与体内脂肪总量密切相关的指标,主要反映全身性超重和肥胖。由于BMI计算的是身体脂肪的比例,所以在测量身体因超重而面临心脏病、高血压等风险上,比单纯的以体重来认定,更具准确性。特别要强调的是,不是每个人都适用BMI
的,如果你属于有以下的情况,那么BMI指数对你不适用:
  1. 未满18岁。
  2. 是运动员。
  3. 正在做重量训练。
  4. 怀孕或哺乳中。
  5. 身体虚弱或久坐不动的老人。
为你推荐:
其他类似问题
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。BMI体重指数计算器
最近在自学android,先练手做一个小项目BMI。顺便了解一下如何写博客,如何使用GitHub,第一次写博客,有不好的地方还请大神赐教。
BMI指数(身体质量指数,简称体质指数,又称体重指数,英文为Body Mass Index,简称BMI)是用体重公斤数除以身高米数平方得出的数字。
BMI指数计算
体质指数(BMI)=体重(kg)÷身高^2(m)
18.5&=bmi&24
24&=bmi&28
好了,了解了BMI之后开始正式写代码。
其实做这个项目大体就需要两步,第一步是编写界面,第二步是按钮的点击事件。
首先先建一个BMI的android项目。
 先来几张app截图
现在开始我们的项目之旅~
首先先要写这个界面,我们可以采用线性布局 ,垂直分布,其中身高和体重那里又需要一个线性布局,要把三个控件水平排放,好,直接上代码。
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.mjy_bmi.MainActivity" &
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:text="@string/title"
android:textColor="#ff00ff"
android:textSize="30dp" /&
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" &
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_gravity="center"
android:layout_weight="1"
android:text="身高:"
android:textColor="#ffaa00"
android:textSize="20dp" /&
android:id="@+id/height"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center"
android:textSize="20dp" /&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="30dp"
android:layout_weight="1"
android:text="m"
android:layout_gravity="center"
android:textColor="#ffaa00"
android:textSize="20dp" /&
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp" &
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_gravity="center"
android:layout_weight="1"
android:text="体重:"
android:textColor="#bbaa00"
android:textSize="20dp" /&
android:id="@+id/weight"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:textSize="20dp" /&
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="30dp"
android:layout_weight="1"
android:text="kg"
android:textColor="#bbaa00"
android:layout_gravity="center"
android:textSize="20dp" /&
android:id="@+id/bmi"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="#aaddaa"
android:text="计算BMI"
android:textColor="#ccff00" /&
android:id="@+id/display"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:textColor="#00ff00"
android:textSize="20dp"
是不是很简单,都是一些特别简单的属性,先写一个大体的界面,然后再优化一下,给他们添加颜色,修改字体等等。
第二步,在MainActivity中按钮的点击事件的实现
package com.example.mjy_
import android.app.A
import android.os.B
import android.view.M
import android.view.MenuI
import android.view.V
import android.view.View.OnClickL
import android.view.W
import android.widget.B
import android.widget.EditT
import android.widget.TextV
import android.widget.T
public class MainActivity extends Activity {
EditText height,
String heigh_string,weight_
private double
private double weight_double,height_
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
height=(EditText) findViewById(R.id.height);
weight=(EditText) findViewById(R.id.weight);
display=(TextView) findViewById(R.id.display);
bmi=(Button) findViewById(R.id.bmi);
bmi.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (height.getText().toString().trim().length()==0) {
height.setError("请输入身高");
if (weight.getText().toString().trim().length()==0) {
weight.setError("请输入体重");
heigh_string=height.getText().toString().trim();
weight_string=weight.getText().toString().trim();
height_double=Double.valueOf(heigh_string);
weight_double=Double.valueOf(weight_string);
result=weight_double*1.0/height_double/height_
if(result&18.5){
display.setText("你的BMI值为"+result+",呀,你太轻了,多吃点好吃的补补吧,不用担心长胖哦~");
display.getText();
if(result&=18.5&&result&24){
display.setText("你的BMI值为"+result+",属于健康体重哦,继续保持哦~");
display.getText();
if(result&=24&&result&28){
display.setText("你的BMI值为"+result+",哎呀,超重了哦,注意锻炼身体哦,使自己有一个健康的身体,加油,相信你!");
display.getText();
if(result&=28){
display.setText("你的BMI值为"+result+",您处于肥胖状态哦,一定要注意锻炼身体了,拥有一个健康的身体很重要哦~");
display.getText();
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
return super.onOptionsItemSelected(item);
height,weight首先获取文本框中的值,注意他现在是字符串的形式,我们要计算的话必须把他转化成double类型。在计算之前,我们先判断身高和体重是否为串。首先了解Trim()函数,删除字符串首尾的空白(可以首尾一起,也可以指定首或尾,取决于控制参数),但会保留字符串内部作为词与词之间分隔的空格。
if (height.getText().toString().trim().length()==0) {
height.setError("请输入身高");
如果不为空的话,将字符串类型转化为double类型进行计算
heigh_string=height.getText().toString().trim()
weight_string=weight.getText().toString().trim()
height_double=Double.valueOf(heigh_string)
weight_double=Double.valueOf(weight_string)
带入计算公式
result=weight_double*1.0/(height_double*height_double);
if(result&18.5){
display.setText("你的BMI值为"+result+",属于健康体重哦,继续保持哦~");
display.getText();
先设置他的文本,再显示他的文本。
好了,简简单单几步,一个小小的BMI app出世了,是不是很简单呐,当然,你还可以在此基础上继续对它进行优化。
第一次写博客,不知道写的东西好不好,以后会继续坚持下去的,每次做一个项目,直接把项目总结写到博客里面。新手上路,大牛勿喷,大家一起学习,一起进步吧!
最后附上源代码
[BMI源代码下载地址](https://github.com/mujuyan/BMI)
python——体质指数BMI
用前端写BMI计算并且提交数据
Android入门项目(一):BMI体质指数计算器
JAVA Swing实现简单的体重指数(BMI)计算器
【BMI指数计算器V2.0】项目实战
体重指数计算器 (Body Mass Index Calculator)
【BMI指数计算器V1.0】项目实战
Android开发--身高体重指数(BIM)计算--完成BMI程序
没有更多推荐了,发生了什么?
随着移动互联的快速普及,用户越来越喜欢在手机端查看内容、交流互动。为了让大家不错过任何精彩瞬间,我们将小组和MOOC迁移至饭团,丰富产品使用功能,提供优质用户体验。
什么是饭团?
饭团是一个自由交流的平台,所有人都可以发布内容,和兴趣相投的人直接分享你的见解;内嵌于微信之中,操作简单,随时随地与他人交流!
我要怎么找到它?
小组和MOOC的用户内容和资料导出功能即将上线}

我要回帖

更多关于 怎么计算BMI 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信