Posts

Showing posts from October, 2011

Android : Properties for SHAPE xml

What are the properties you can use when you're creating a SHAPE xml for styling your layout such as gridview or button? Please check this link out :- http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape

Android Programmatically apply style to your view

Applying style to your view (button in this case) dynamically is pretty easy. All you have to do is place the following in your layout folder (res/layout) Let's call this file : buttonstyle.xml <?xml version="1.0" encoding="utf-8"?> < selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" > <shape> <solid android:color="#449def" /> <stroke android:width="1dp" android:color="#2f6699" /> <corners android:radius="3dp" /> <padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /> </shape> </item> <item> <shape> <gradient android:startColor="#449def