关于时间的设置的问题
请问老师如何实现触屏发生倒计时60的功能
使用Chronometer控件却启动不了程序了
请问老师该怎么解决
3
收起
正在回答
5回答
你改线性布局启动不了,看看报什么错,是不是FlappyBird属性里的约束属性没有去掉丫,另外你想让倒计时显示在屏幕某一个角,也可以用约束布局为根布局,只不过需要把倒计时加上约束属性就可以了。
玺鸥
2019-11-07 19:28:53
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 将整个约束布局改成线性布局之后启动不了 <? xml version = "1.0" encoding = "utf-8" ?> < android.LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" xmlns:app = "http://schemas.android.com/apk/res-auto" xmlns:tools = "http://schemas.android.com/tools" android:layout_width = "match_parent" android:layout_height = "match_parent" tools:context = ".MainActivity" > < com.example.birdfly.game.FlappyBird android:layout_width = "0dp" android:layout_height = "0dp" app:layout_constraintBottom_toBottomOf = "parent" app:layout_constraintHorizontal_bias = "0.0" app:layout_constraintLeft_toLeftOf = "parent" app:layout_constraintRight_toRightOf = "parent" app:layout_constraintTop_toTopOf = "parent" app:layout_constraintVertical_bias = "0.0" /> < Chronometer android:layout_width = "match_parent" android:layout_height = "wrap_content" android:format = "00:00:00" android:gravity = "bottom" android:textSize = "30dp" android:id = "@+id/timer" /> </ android.LinearLayout > |
玺鸥
2019-11-07 19:13:14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout android:layout_width = "match_parent" android:layout_height = "wrap_content" xmlns:app = "http://schemas.android.com/apk/res-auto" android:orientation = "vertical" xmlns:android = "http://schemas.android.com/apk/res/android" > < com.example.birdfly.game.FlappyBird android:layout_width = "0dp" android:layout_height = "0dp" app:layout_constraintBottom_toBottomOf = "parent" app:layout_constraintHorizontal_bias = "0.0" app:layout_constraintLeft_toLeftOf = "parent" app:layout_constraintRight_toRightOf = "parent" app:layout_constraintTop_toTopOf = "parent" app:layout_constraintVertical_bias = "0.0" /> < Chronometer android:layout_width = "match_parent" android:layout_height = "wrap_content" android:format = "00:00:00" android:gravity = "bottom" android:textSize = "30dp" android:id = "@+id/timer" /> </ LinearLayout > |
玺鸥
2019-11-07 18:47:48
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | <? xml version = "1.0" encoding = "utf-8" ?> < android.support.constraint.ConstraintLayout xmlns:android = "http://schemas.android.com/apk/res/android" xmlns:app = "http://schemas.android.com/apk/res-auto" xmlns:tools = "http://schemas.android.com/tools" android:layout_width = "match_parent" android:layout_height = "match_parent" tools:context = ".MainActivity" > < com.example.birdfly.game.FlappyBird android:layout_width = "0dp" android:layout_height = "0dp" app:layout_constraintBottom_toBottomOf = "parent" app:layout_constraintHorizontal_bias = "0.0" app:layout_constraintLeft_toLeftOf = "parent" app:layout_constraintRight_toRightOf = "parent" app:layout_constraintTop_toTopOf = "parent" app:layout_constraintVertical_bias = "0.0" /> < Chronometer android:layout_width = "match_parent" android:layout_height = "wrap_content" android:format = "00:00:00" android:gravity = "bottom" android:textSize = "30dp" android:id = "@+id/timer" /> </ android.support.constraint.ConstraintLayout > |
3.Android 高级应用与Kotlin综合实战
- 参与学习 人
- 提交作业 116 份
- 解答问题 1012 个
本阶段是提升项目经验的必备,除Android开发的高级控件,还有Android官方大力推荐的开发语言Kotlin,未来Android发展的方向,最后使用Kotlin来开发热门电商项目。
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧