Search icon CANCEL
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Android Wear Projects

You're reading from  Android Wear Projects

Product type Book
Published in Jul 2017
Publisher Packt
ISBN-13 9781787123229
Pages 416 pages
Edition 1st Edition
Languages
Author (1):
Ashok Kumar S Ashok Kumar S
Profile icon Ashok Kumar S

Table of Contents (18) Chapters

Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Getting You Ready to Fly - Setting Up Your Development Environment 2. Let us Help Capture What is on Your Mind - WearRecyclerView and More 3. Let us Help Capture What is on Your Mind - Saving Data and Customizing the UI 4. Measure Your Wellness - Sensors 5. Measuring Your Wellness and Syncing Collected Sensor Data 6. Ways to Get Around Anywhere - WearMap and the GoogleAPIclient 7. Ways to Get Around Anywhere - UI controls and More 8. Let us Chat in a Smart Way - Messaging API and More 9. Let us Chat in a Smart Way - Notifications and More 10. Just a Face for Your Time - WatchFace and Services 11. More About Wear 2.0

Changing marker color and customizing


Using the MarkerOptions class, we can the and icon of the marker. The following code both the icon and color of the marker.

To change the color of the marker, please refer to the following code:

private void addMarker(Memory memory) {
    Marker marker = mMap.addMarker(new MarkerOptions()
          .draggable(true).icon(BitmapDescriptorFactory.defaultMarker
          (BitmapDescriptorFactory.HUE_CYAN)).alpha(0.7f)
            .position(new LatLng(memory.latitude, memory.longitude)));

    mMemories.put(marker.getId(), memory);
}

We can now see that the marker color is changed from red to cyan with transparency. If you wish to remove the transparency, you can remove the .alpha() value passed to marker options:

Changed marker color

To the to an icon the drawable directory, check following code:

private void addMarker(Memory memory) {
    Marker marker = mMap.addMarker(new MarkerOptions()
            .draggable(true).icon(BitmapDescriptorFactory.fromResource...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}