How to make the corners of a button round?

If you want something like this here is the code. 1.Create a xml file in your drawable folder like mybutton.xml and paste the following markup: <?xml version=”1.0″ encoding=”utf-8″?> <selector xmlns:android=”http://schemas.android.com/apk/res/android” > <item android:state_pressed=”true” > <shape android:shape=”rectangle” > <corners android:radius=”3dip” /> <stroke android:width=”1dip” android:color=”#5e7974″ /> <gradient android:angle=”-90″ android:startColor=”#345953″ android:endColor=”#689a92″ /> </shape> </item> <item android:state_focused=”true”> <shape android:shape=”rectangle” … Read more

UIView with rounded corners and drop shadow?

Swift // corner radius blueView.layer.cornerRadius = 10 // border blueView.layer.borderWidth = 1.0 blueView.layer.borderColor = UIColor.black.cgColor // shadow blueView.layer.shadowColor = UIColor.black.cgColor blueView.layer.shadowOffset = CGSize(width: 3, height: 3) blueView.layer.shadowOpacity = 0.7 blueView.layer.shadowRadius = 4.0 Exploring the options Problem 1: Shadow gets clipped off What if there are sublayers or subviews (like an image) whose content we want … Read more