How do I display a button in a random screen position in android? For example I have a button that is named GO. When I click GO, it will bring me to the second screen. That second screen will display another button (not the START button) in random screen position. How can I do that?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
If you target
Icecream Sandwich
and above, you can set the position of the button very easily You can use the below functions to move to a random position. You can calculatex
randomly based on the screen width.For the older phones, you can make a random animation with 0 second long.
AbsoluteLayout is now deprecated, You can move a View(when it's touched) in random screen position this way easily.
For the second screen use
absolute layout
, but the button on X=0, Y=0Once your second screen gets activated.
onCreate
MethodEDIT User wanted to know how to write AbsoluteLayout