I would like to place a button on top of my google map, which is pretty easy. However I would like it to look like the buttons google uses (zoom buttons, locate me button). Is there a way I can 'cheat' and find the styles they used for their buttons. Or has anyone else created this style before?
相关问题
- 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 disassemble Google Play Services apk by using apktool, and look into
drawable
* folders, you will find the resources for these buttons among other resources.For example, this is the drawable of the upper zoom button:
res/drawable/maps_btn_zoom_up.xml
, and this is the "empty" button:res/drawable/maps_btn_standalone.xml
. Looking at them, it is a lot easier to match their style.The apk will probably be named like
com.google.android.gms-#.apk
, where#
is some number; you can snatch it from a device which has Google Play Services installed by usingadb pull
command, it doesn't even require rooting if you know the exact file name.Update
Here is the archive with relevant resources for the empty standalone button, obtained by this way.
(sha256:
4b974a8c23bb8df54b9aa244489e8a7ab5d4d3e17d0c003f411bccbe8a75d622
)And some numbers:
Button height and width is
38dp
Shadow padding: top
1.5dp
bottom2.5dp
side2dp
The background image is NOT nine-patch, but it's pretty easy to create one if you need.
The button is a 70% semi-transparant white.
Or in HEX, #B3FFFFFF
I made this 9-patch image to use as background for the view that you want to be like a google maps button:
The color of the button content is #666666.
Here is an example of a custom view that looks like a google maps button using that background and that color for the text:
example http://oi59.tinypic.com/9fyxdx.jpg
I was looking for the same thing, and found this question:Change zoom controls in a MapView
It appears a button is 2 images, a normal state and a clicked state. For your purposes, you'd need to style the button yourself / 'cheat' the system. You can get a good template from either the google play lib or the support library.
You can download them at Googles design page: Google Design - I think the section Action Bar icon pack is what you are looking for. Also inside I will find both themes Holo light and dark designs.