Android button beautification style implementation code

Don't say much, run the renderings on the

Create a new button in the drawable folder_ drawable.xml

<?xml version="1.0" encoding="utf-8" ?>
<!--相当于做了一张圆角的图片,然后给button作为背景图片-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="rectangle">
  <!--设置背景色-->
  <solid android:color="#7457ED" />
  <!--设置圆角-->
  <corners android:radius="105dip" />
  <padding
  android:bottom="12dp"
  android:left="63dp"
  android:right="63dp"
  android:top="12dp"
  />
  <!--设置边框线的宽度和颜色-->

</shape>
// An highlighted block
var foo = 'bar';

Just refer to it in the button attribute

<Button
      android:id="@+id/buttona1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_gravity="center_horizontal"
      android:background="@drawable/button_drawable"
      android:textColor="#ffffff"
      android:textSize="16dp"
      android:gravity="center_horizontal"
      android:text="登陆"
      />
      // An highlighted block
var foo = 'bar';

summary

The above is the implementation code of Android button beautification style introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message, and Xiaobian will reply to you in time. Thank you very much for your support to our website! If you think this article is helpful to you, welcome to reprint, please indicate the source, thank you!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>