Stylingandroid

Styling Android " Blog Archive " More Vector Drawables - Part 2


razarahil6 retweets
Styling Android

April 27, 2012

Let’s start by creating a new drawable in res/drawable/panel.xml:

On the outside we have a layer-list drawable. This allows us to position one drawable on top of another. At the moment we only have a single child drawable of our layer-list, but we’ll be adding another one in due course. This child is a simple shape drawable which has a dark grey border, and a subtle radial gradient which is positioned at the top edge.

If we try this we get the following:

That’s looking pretty good, but what about if we want a 3D effect on the border, giving the illusion of a raised panel. Thsi can be achieved by adding a second drawable to our layer-list. layer-list will draw its children in order, with the last one being drawn last, or on top of the others. We can use use an inset drawable with a transparent fill and a light grey border, with the bottom and right edges pushed outside the bounds of the layer-list:

This will effectively draw a light grey border over the left and top edges of the existing border giving us the 3D effect that we require:

Finally, we can add some text with a white shadow to give an engraved look as was covered in this article :

If we run this we now get:

That concludes this short series on vector drawable.

The source code for this article can be found here .

© 2012, Mark Allison . All rights reserved. This article originally appeared on Styling Android .

Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License

Posted by Mark Allison

Styling Android for Kindle

Styling Android is now available on your Kindle. Click the relevant Amazon logo to subscribe:

Social Media

AndroidConf Brasil 2011

You can view my presentation on Android Layouts from AndroidConf Brasil 2011 here

Recent Posts

Related tweets — «Just posted to Styling Android: More Vector Drawables - Part 2 #androiddev»

A photo from @Samsung_ID

Picture of daguilar6
30 Jul 2012
2 retweets
Samsung GALAXY Beam, smartphone Android dgn fitur mobile proyektor! Enrich entertainment with close friends anywhere!

OLD Javascript to Android App FAST | AJAX | Android |...

Picture of daguilar6
30 Jul 2012
21 retweets
OLD Javascript to Android App FAST by HugoDesign: Hello, I would like a mobile app developer to take ... #sem #jobs

Angry Birds - Most Useful Android Apps

Picture of daguilar6
30 Jul 2012
0 retweets
Hey Android users, check out the 15 best Android apps. I love #3

Android IPTV Player for Set-Top-Box | Android

Picture of daguilar6
30 Jul 2012
7 retweets
Android IPTV Player for Set-Top-Box by androidtester: Aim of the project: to develop an application that plays I...

Dotlife Mid Year Sale ลดราคาสมาร์ทโฟนเเละเเท็บเล็ต An...

http://specphone.com/web/39516/do...

Dotlife Mid Year Sale ลดราคาสมาร์ทโฟนเเละเเท็บเล็ต Android สูงสุดถึง 70%
Adjust text size : สินค้ามีสองเเบบคือเป็นตัวเดโม (ไม่มีประกัน) กับเเบบลดราคา อย่าง Galaxy S II ที่ลดราคาก็จะมทีสองเเบบ คือเเบบ 13,xxx นั้นเป็นเเบบไม่มีประกัน ส่วนเเบบ 15,xxx ก็จะเป็นเเบบมีประกันให้ ส่วนใครใช้บริการ True นั้นสามารถเเสดงสิทธิ์ลดเพิ่มอีก 10% สำหรับสินค้าที่กำหนด (คงต้องไปถามหน้างานเอง) เเละมี Accessories อื่นๆ ให้เลือกดูกันตามอัธยาศัย งาน Dotlife Mid Year Sale นี้จัดเฉพาะที่สาขาเซนทรัลลาดพร้าว วันที่ 27 กรกฏาคมถึง 5 สิงหาคมนี้ครับ     SEARCH :     

Picture of daguilar6
30 Jul 2012
7 retweets

Noticias - Skype, uno de los más descargados en iOS y...

http://analitica.com/tecnologia/6...

Lunes, 30 de julio de 2012 Skype fue descargado 76 millones de veces por usuarios Android, 85 millones de veces por dueños de iPhone y 23 millones de ocasiones por quienes cuentan con un iPad    Foto: Google La aplicación del servicio de VoIP se convirtió en una de las más descargadas por los usuarios de dispositivos móviles durante el año 2011, siendo solo superado por Angry Birds de Rovio y Facebook. Reseña radiosantiago.cl Skype fue descargado 76 millones de veces por usuarios Android, 85 millon...

Picture of daguilar6
30 Jul 2012
3 retweets

#androiddev in images

#AndroidDev #Design A new version of Android Design P...

https://plus.google.com/113735310...

#AndroidDev #Design A new version of Android Design Preview is now available! Version 0.3 inclu...
AndroidDev #Design A new version of Android Design Preview is now available! Version 0.3 includes the following new features: * Scale the mirror region up or down in increments of 25%; should be useful if your mockups don't fit on your desktop screen. * Use a local image file as a source (instead of your desktop screen).

Picture of daguilar6
20 Jul 2012
26 retweets

Wow, @Accenture opensourced hardware #OpenGL for #and...

Picture of daguilar6
6 Oct 2011
5 retweets
Wow, @Accenture opensourced hardware #OpenGL for #androiddev emulator at #droidconUK !!

Mayooresan's Twitter Photo

http://twitter.com/mayooresan/sta...

Mayooresan's Twitter Photo
Hindi UI in Jelly Bean #AndroidDev #Android http://t.co/erKTBxFQ

Picture of daguilar6
6 Jul 2012
4 retweets

#androiddev in videos

Google I/O 2012 - What's New in Android Developers' T...

Picture of daguilar6
29 Jun 2012
50 retweets
My favorite Google I/O 2012 talk: #android #androiddev

Google I/O 2012 - Android WebView

Picture of daguilar6
10 Jul 2012
11 retweets
Using WebView in your app? Designing mobile sites for Android? Watch this Google I/O talk: https://t.co/C0Mfsagd #android #androiddev

Ice Cream Sandwich Emulator Crash

Picture of daguilar6
19 Oct 2011
6 retweets
Here's a video showing how quickly the #IceCreamSandwich Emulator crashes on my machine - #androiddev

#androiddev in articles

Android Developers Blog: New Layout Widgets: Space an...

http://android-developers.blogspo...

Android Developers Blog: New Layout Widgets: Space and GridLayout
This post is by Philip Milne, who is part of the Android framework team. — Tim Bray] Ice Cream Sandwich (ICS) sports two new widgets that have been designed to support the richer user interfaces made possible by larger displays: Space and GridLayout .

Picture of daguilar6
11 Nov 2011
16 retweets

+Android Developers, always be mindful of Context whe...

Picture of daguilar6
5 Mar 2012
12 retweets
@romainguy advice on how to use Contexts and Views https://t.co/4k6vRuU3 #android #androiddev

#AndroidDev Now that our Android Developer Labs have ...

https://plus.google.com/113735310...

#AndroidDev Now that our Android Developer Labs have wrapped up for 2011, with last week's ADL Ho...
AndroidDev Now that our Android Developer Labs have wrapped up for 2011, with last week's ADL Hong Kong capping off the world tour, we'd like to share some of the presentation material we discussed during the events. Introduction to Honeycomb APIs A must-read for Android developers new to Android 3.0+ development.

Picture of daguilar6
13 Dec 2011
10 retweets

#androiddev in sites

Google Groups

https://groups.google.com/forum...

The source code of Android 4.1 Jelly Bean is now available #android #androiddev https://t.co/kAeU2zln

Picture of daguilar6
10 Jul 2012
1K retweets

Google Moderator

http://google.com/moderator

Guys I just uploaded my idea for the DevFest. How to NFC - NFC on Android (Apps and Examples) #nfc #androiddev #devfest

Picture of daguilar6
21 May 2010
7K retweets

Android Developers

Picture of daguilar6
9 Feb 2009
2K retweets
Android developer site has got a brand new UI. Looks sweet! Take a look: #android #AndroidDev