I want to make the corners of a button
round. Is there an easy way to achieve this in Android?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
style button with icon
shape.xml
Create rounded_btn.xml file in Drawable folder...
and use this.xml file as a button background
This link has all the information you need. Here
Shape.xml
and main.xml
This should give you your desired result.
Best of luck
It's so simple. Create an XML file like below one. Set it as background for the button. Change the radius attribute to your wish, if you need more curve for the button.
button_background.xml
Set background to your button:
if you are using vector drawables, then you simply need to specify a <corners> element in your drawable definition. I have covered this in a blog post.
If you are using bitmap / 9-patch drawables then you'll need to create the corners with transparency in the bitmap image.
create shape.xml in drawable folder
like shape.xml
and in myactivity.xml
you can use