当前位置:网站首页>Training log III of "Shandong University mobile Internet development technology teaching website construction" project
Training log III of "Shandong University mobile Internet development technology teaching website construction" project
2022-07-29 05:49:00 【BEER_ seven】
Time :
21 The sixth week of spring semester
Personal work content :
Complete the compass case app
Export the components and colors of all visual drafts
Record in detail :
- Compass case app Design description
- Target users :android Students at the introductory stage of development .
- Requirement specification : Explain how to use the sensor , Animation use simple teaching
- Design description : Use a pointer disc to indicate the pointer facing north , After acquiring the deviation angle, the sensor rotates the pointer disc and marks the deviation angle , When approaching the north, the font turns red to emphasize the correctness of orientation
Key points
- Compass page

xml file :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center"
android:background="#211E1E">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NORTH"
android:textColor="#FFFFFF"
android:textSize="50sp" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/compass3"
android:layout_marginTop="60dp"/>
<TextView
android:id="@+id/degree"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0°"
android:textColor="#FFFFFF"
android:textSize="50sp"
android:layout_marginTop="60dp"/>
</LinearLayout>
- When approaching the north , The angle indicator will turn red , In the method of sensor monitoring direction change, the degree can be judged

SensorListener Inner class :
// adopt getSystemService get SensorManager Instance object
manager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
private final class SensorListener implements SensorEventListener {
private float predegree = 0;
// The sensor monitors a change in direction
public void onSensorChanged(SensorEvent event) {
float degree = event.values[0];// Stored the direction value 90
Animation , Write in the method of monitoring the direction change of the upper sensor :
RotateAnimation animation = new RotateAnimation(predegree, -degree,
Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
// The duration of the rotation process
animation.setDuration(200);
// Compass pictures use rotation animation
imageView.startAnimation(animation);
predegree = -degree;
Later work planning :
- Complete the case of shaking the alarm clock next week App Development and teaching design
边栏推荐
- DAY6:利用 PHP 编写文件上传页面
- DAY6:利用 PHP 编写登陆页面
- Okaleido Tiger 7.27日登录Binance NFT,首轮已获不俗成绩
- 与开源项目同步开发& CodeReview & Pull Request & fork怎么拉取原始仓库
- Day14: upload labs customs clearance tutorial
- 量化开发必掌握的30个知识点【什么是分笔逐笔数据】?
- Madonna "hellent" bought $1.3 million NFT boring ape, which is now considered too expensive
- xSAN高可用—XDFS与SAN融合焕发新生命力
- Get the number of daffodils
- QFrame类学习笔记
猜你喜欢

Laravel服务容器(上下文绑定的运用)

Fantom (FTM) surged 45% before the FOMC meeting

Starfish OS:以现实为纽带,打造元宇宙新范式

php写一个购买全网最低价的纸尿裤

sql-server 数据表的简单操作

超简单集成HMS ML Kit 实现parental control

Sqlmap是什么以及使用方法

Gluster cluster management analysis

From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run

Laravel Swagger添加访问密码
随机推荐
MOVE PROTOCOL全球健康宣言,将健康运动进行到底
Day14: upload labs customs clearance tutorial
Build msys2 environment with win10
How can Plato obtain premium income through elephant swap in a bear market?
如何 Pr 一个开源composer项目
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
山寨币SHIB 在 ETH 鲸鱼的投资组合中拥有 5.486 亿美元的股份——交易者应提防……
与开源项目同步开发& CodeReview & Pull Request & fork怎么拉取原始仓库
从Starfish OS持续对SFO的通缩消耗,长远看SFO的价值
Changed crying, and finally solved cannot read properties of undefined (reading 'parsecomponent')
Win10 compiles ffmpeg (including ffplay)
浅谈分布式全闪存储自动化测试平台设计
Laravel服务容器(继承与事件)
Laravel service container (inheritance and events)
Qt布局管理--部件拉伸(Stretch)原理及大小策略(sizePolicy)
Laravel service container (Application of context binding)
华为2020校招笔试编程题 看这篇就够了(上)
Reporting Services- Web Service
“山东大学移动互联网开发技术教学网站建设”项目实训日志六
ReportingService WebService Form身份验证