如何制作圆形按钮? [英] How to make a round button?

查看:42
本文介绍了如何制作圆形按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作圆形按钮,但我不知道该怎么做.我可以制作带圆角的按钮,但我怎么能圆圆.这是不一样的.请告诉我,在Android上可以吗?谢谢你.

I'm trying to make a round button, but I don't know how can I do it. I can make button with rounded corners, but how can I can round circle. It's not the same. Please, tell me, is it possible on Android? Thank you.

推荐答案

在 drawable 文件夹中创建一个名为 roundedbutton.xml 的 xml 文件

Create an xml file named roundedbutton.xml in drawable folder

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle">
    <solid android:color="#eeffffff" />
    <corners android:bottomRightRadius="8dp"
        android:bottomLeftRadius="8dp"  
        android:topRightRadius="8dp"
        android:topLeftRadius="8dp"/>
</shape>

最后将其设置为 Button 的背景为 android:background = "@drawable/roundedbutton"

Finally set that as background to your Button as android:background = "@drawable/roundedbutton"

如果你想让它完全圆润,改变半径并选择适合你的东西.

If you want to make it completely rounded, alter the radius and settle for something that is ok for you.

这篇关于如何制作圆形按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆