Download presentation
Presentation is loading. Please wait.
1
Android: Shapes
2
Right click on res/drawable select New/Android XML
3
Supply a filename (small letters) Choose shape as the root element
Supply a filename (small letters) Choose shape as the root element. Click Finish.
4
Enter a gradient element, supply its startColor and endColor attributes.
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android=" > <gradient android:startColor="#cccccc" android:endColor="#333333" /> </shape>
5
In your layout add a background attribute and set its value to the xml file you just placed in drawable
6
The result in Graphical Layout mode.
7
Add another Android XML file to drawable
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android=" android:shape="oval"> <solid android:color="#3399ff" /> </shape>
8
Set the TextView’s android:background attribute to &srawable/my_circle
9
Result of setting TextView’s background to shape (oval)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.