当前位置:网站首页>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
边栏推荐
- DAY15(DAY16拓展):文件包含漏洞
- Reporting Service 2016 自定义身份验证
- OpenAtom OpenHarmony分论坛圆满举办,生态与产业发展迈向新征程
- 以‘智’提‘质|金融影像平台解决方案
- Flink connector Oracle CDC 实时同步数据到MySQL(Oracle19c)
- Read and understand move2earn project - move
- 熊市下PLATO如何通过Elephant Swap,获得溢价收益?
- July 28 ens/usd Value Forecast: ENS attracts huge profits
- Flink connector Oracle CDC 实时同步数据到MySQL(Oracle12c)
- 大部分PHP程序员,都搞不懂如何安全代码部署
猜你喜欢
随机推荐
Relationship between redrawing and reflow
深度学习的趣味app简单优化(适合新手)
“山东大学移动互联网开发技术教学网站建设”项目实训日志一
DAY4:MySQL 数据库的建立及简单实用
iSCSI vs iSER vs NVMe-TCP vs NVMe-RDMA
量化开发必掌握的30个知识点【什么是分笔逐笔数据】?
JDBC连接数据库详细步骤
ReportingService WebService Form身份验证
Detailed steps of JDBC connection to database
性能对比|FASS iSCSI vs NVMe/TCP
MOVE PROTOCOL全球健康宣言,将健康运动进行到底
超简单集成HMS ML Kit 实现parental control
加密资产熊市之下,PlatoFarm的策略玩法依旧能获得稳定收益
Xsan is highly available - xdfs and San are integrated with new vitality
Under the bear market of encrypted assets, platofarm's strategy can still obtain stable income
Refresh, swagger UI theme changes
7 月 28 日 ENS/USD 价值预测:ENS 吸引巨额利润
Read and understand move2earn project - move
Differences between href and SRC
Dao race track is booming. What are the advantages of m-dao?