手机没有温度传感器所以没有温度计功能,部份软件可以显示温度,那只是网络数据和理论数据如何在Android手机上画温度计。main.xml文件[html] view plain copy print??LinearLayout xmlns:android="" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" EditText android:id="@+id/inputtem" android:layout_width="150dip" android:layout_height="wrap_content" android:hint="输入温度" /EditText Button android:id="@+id/lookup" android:layout_width="150dip" android:layout_height="wrap_content" android:text="温度计显示" /Button SurfaceView android:id="@+id/surface" android:layout_width="fill_parent" android:layout_height="wrap_content" / /LinearLayout ?
手机没有温度传感器所以没有温度计功能,部份软件可以显示温度,那只是网络数据和理论数据
main.xml文件
[html] view plain copy print?
?xml version="1.0" encoding="utf-8"?
LinearLayout xmlns:android=""
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
EditText android:id="@+id/inputtem" android:layout_width="150dip"
android:layout_height="wrap_content" android:hint="输入温度"
/EditText
Button android:id="@+id/lookup" android:layout_width="150dip"
android:layout_height="wrap_content" android:text="温度计显示"
/Button
SurfaceView android:id="@+id/surface"
android:layout_width="fill_parent" android:layout_height="wrap_content" /
/LinearLayout
?xml version="1.0" encoding="utf-8"?
LinearLayout xmlns:android=""
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent"
EditText android:id="@+id/inputtem" android:layout_width="150dip"
android:layout_height="wrap_content" android:hint="输入温度"
/EditText
Button android:id="@+id/lookup" android:layout_width="150dip"
android:layout_height="wrap_content" android:text="温度计显示"
/Button
SurfaceView android:id="@+id/surface"
android:layout_width="fill_parent" android:layout_height="wrap_content" /
/LinearLayout
Activity文件:(Thermometer.java)
[java] view plain copy print?
import android.app.Activity;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.SurfaceHolder.Callback;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
/*
* @author yuanbieli 20110805
* */
public class Thermometer extends Activity implements Callback {
private SurfaceView mSurface;
private SurfaceHolder mHolder;
private EditText mEditText;
private Button mDisOnThe;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mSurface = (SurfaceView) findViewById(R.id.surface);
mEditText = (EditText) findViewById(R.id.inputtem);
mDisOnThe = (Button) findViewById(R.id.lookup);
mHolder = mSurface.getHolder();
mHolder.addCallback(this);
mDisOnThe.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String tem = mEditText.getText().toString();
draw(tem);
}
});
}
private void draw(String temp) {
float tem1 = Float.parseFloat(temp);
int y = 260 - (int) ((tem1 - 35) * 20);
Canvas canvas = mHolder.lockCanvas();
Paint mPaint = new Paint();
mPaint.setColor(Color.WHITE);
canvas.drawRect(40, 50, 60, 280, mPaint);
Paint paintCircle = new Paint();
paintCircle.setColor(Color.RED);
Paint paintLine = new Paint();
paintLine.setColor(Color.BLUE);
canvas.drawRect(40, y, 60, 280, paintCircle);
canvas.drawCircle(50, 300, 25, paintCircle);
int ydegree = 260;
int tem = 35;
while (ydegree 55) {
canvas.drawLine(60, ydegree, 67, ydegree, mPaint);
if (ydegree % 20 == 0) {
canvas.drawLine(60, ydegree, 72, ydegree, paintLine);
canvas.drawText(tem + "", 70, ydegree + 4, mPaint);
tem++;
}
ydegree = ydegree - 2;
}
mHolder.unlockCanvasAndPost(canvas);// 更新屏幕显示内容
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// TODO Auto-generated method stub
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub
}
}
import android.app.Activity;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.SurfaceHolder.Callback;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
/*
* @author yuanbieli 20110805
* */
public class Thermometer extends Activity implements Callback {
private SurfaceView mSurface;
private SurfaceHolder mHolder;
private EditText mEditText;
private Button mDisOnThe;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mSurface = (SurfaceView) findViewById(R.id.surface);
mEditText = (EditText) findViewById(R.id.inputtem);
mDisOnThe = (Button) findViewById(R.id.lookup);
mHolder = mSurface.getHolder();
mHolder.addCallback(this);
mDisOnThe.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String tem = mEditText.getText().toString();
draw(tem);
}
});
}
private void draw(String temp) {
float tem1 = Float.parseFloat(temp);
int y = 260 - (int) ((tem1 - 35) * 20);
Canvas canvas = mHolder.lockCanvas();
Paint mPaint = new Paint();
mPaint.setColor(Color.WHITE);
canvas.drawRect(40, 50, 60, 280, mPaint);
Paint paintCircle = new Paint();
paintCircle.setColor(Color.RED);
Paint paintLine = new Paint();
paintLine.setColor(Color.BLUE);
canvas.drawRect(40, y, 60, 280, paintCircle);
canvas.drawCircle(50, 300, 25, paintCircle);
int ydegree = 260;
int tem = 35;
while (ydegree 55) {
canvas.drawLine(60, ydegree, 67, ydegree, mPaint);
if (ydegree % 20 == 0) {
canvas.drawLine(60, ydegree, 72, ydegree, paintLine);
canvas.drawText(tem + "", 70, ydegree + 4, mPaint);
tem++;
}
ydegree = ydegree - 2;
}
mHolder.unlockCanvasAndPost(canvas);// 更新屏幕显示内容
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// TODO Auto-generated method stub
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub
}
}
温度计这种也是有很多很多的啦
你在应用宝上下载就可以了,应用宝就是专门为安卓机打造的
所以里面的软件都是支持安卓机使用的啦,不要担心
你通过输入关键词的方法来进行查找
就可以查找到很多温度计类型的软件啦,然后再根据下载量啊什么的
进行下载就可以了,都是无毒无广告的,可以放心下载啦
用手机测室内温度的方法如下:
工具/原料:iPhone 12、iOS 14、温度计APP3.1.3。
1、在手机商店下载实时温度计APP。
2、打开该APP。
3、可以对测温地点进行设置。
4、可以左右滑动查看温度、湿度、空气质量等。
5、一般手机都自带天气软件,可以查询室外温度。
1、APP商店搜索“实时温度计”
可以实时的测量温度,了解室内室外不同地方的温度差异,还可以使用各种不同的计量单位;
2、android 温度监测
监测温度的APP,通过socket接收温度信息,并实时绘出温度曲线图;
3、实时户外温度
自动定位用户地理位置,然后根据当前地理位置显示当地的室外温度;
4、Pure天气
同大多数天气应用一样,Pure 天气的界面背景也会随着时间的变化而变化。白天时,界面背景以蓝色为主,傍晚时,则以紫色为主;
5、iOS实时温湿度计
iOS版app,检测你所在地区的温度、湿度、空气质量等,为您提供实时天气的温湿度测量,让您随时随地了解当前天气情况;
安卓手机可以下载室内温度计,但是温度测量的不准,手机没有测量温度的感应系统。
声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。
E-mail:langhai8@163.com
本文链接:https://www.wumai.net/tianqi/20221218100509.html