简体   繁体   English

Android曲面中的按钮创建

[英]Button creation in android curved sides

如何创建与android中显示的按钮完全相同的按钮?

I am a new learner, and I am creating an application that calculates tips. 我是一名新手,并且正在创建一个计算提示的应用程序。 how can i make buttons round on left and right sides? 我怎样才能使按钮在左右两侧成圆形?

In your xml add background for your button. 在xml中为按钮添加背景。

          <Button
            android:id="@+id/login_loginbt"
            android:layout_width="fill_parent"
            android:text="Login"
            android:textColor="#ffffff"
            android:background="@drawable/curve_button"
            android:textSize="18dp"
            android:textStyle="bold" />

Then create a new xml "curve_button.xml"and paste this code for curve edged buttons. 然后创建一个新的xml“ curve_button.xml”,并将此代码粘贴到曲线边缘按钮上。

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
 <item >
    <shape android:shape="rectangle"  >
        <corners android:radius="25dip" />
        <stroke android:width="1dip" android:color="#ff0000" />
        <gradient android:angle="-90" android:startColor="#ff0000" android:endColor="#ff0000" />
    </shape>
</item>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM