Android修行手册-看看Button都有哪些属性?

我们来看看shape内部第一层都有什么属性:

<?xml version="1.0" encoding="utf-8"?>

从名字我们就能大致猜出意思了:

corners:此属性是来定义四边圆角的。

gradient:是用来定义渐变颜色的,和solid不同时出现。

solid:是用来绘制实心内部填充色的,和gradient不同时出现。

stroke:描边效果,边缘实线虚线颜色等。

size和padding:何止大小和内边距,padding多数情况下不使用。

示例如下:

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:app=“http://schemas.android.com/apk/res-auto”

xmlns:tools=“http://schemas.android.com/tools”

android:layout_width=“match_parent”

android:layout_height=“match_parent”

android:background=“@color/white”

tools:context=“.TextActivity”>

<Button

android:id=“@+id/mtBtn”

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginLeft=“50dp”

android:layout_marginTop=“10dp”

android:background=“@drawable/btn_shape”

android:elevation=“10dp”

android:rotationX=“-23”

android:rotationY=“-31”

android:rotationZ=“-31”

android:text=“这是按钮”

android:translationX=“2dp”

android:translationZ=“10dp” />

<Button

android:layout_width=“80dp”

android:layout_height=“80dp”

android:layout_marginLeft=“50dp”

android:layout_marginTop=“70dp”

android:background=“@drawable/btn_shape0”

android:elevation=“10dp”

android:text=“芝麻粒儿”

android:translationX=“2dp”

android:translationZ=“10dp” />

<Button

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginLeft=“50dp”

android:layout_marginTop=“150dp”

android:background=“@drawable/btn_shape1”

android:elevation=“10dp”

android:rotationX=“-10”

android:rotationY=“20”

android:rotationZ=“-30”

android:text=“空名先生”

android:translationX=“2dp”

android:translationZ=“10dp” />

<Button

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_alignParentRight=“true”

android:elevation=“30dp”

android:text=“this button”

android:textAllCaps=“false” />

<TextView

android:layout_width=“wrap_content”

android:layout_height=“wrap_content”

android:layout_marginLeft=“30dp”

android:padding=“6dp”

android:layout_marginTop=“220dp”

android:autoLink=“web”

android:background=“@drawable/btn_shape2”

android:gravity=“center”

android:text=“文本:知乎-掘金”

android:textColor=“#ffffff”

android:textSize=“16sp” />

btn_shape0.xml

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android=“http://schemas.android.com/apk/res/android”

android:innerRadius=“30dp”

android:shape=“ring”

android:thickness=“2dp”

android:useLevel=“false”>

btn_shape1.xml

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android=“http://schemas.android.com/apk/res/android”

android:shape=“rectangle”>

btn_shape2.xml

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android=“http://schemas.android.com/apk/res/android”

android:shape=“rectangle”>

<gradient

android:angle=“0”

android:centerColor=“#0000ff”

android:endColor=“#00ff00”

android:startColor=“#ff0000”/>

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数初中级Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则近万的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。

img

img

img

img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且会持续更新!

如果你觉得这些内容对你有帮助,可以扫码获取!!(备注:Android)

最后

最后这里放上我这段时间复习的资料,这个资料也是偶然一位朋友分享给我的,里面包含了腾讯、字节跳动、阿里、百度2019-2021面试真题解析,并且把每个技术点整理成了视频和PDF(知识脉络 + 诸多细节)。

还有 高级架构技术进阶脑图、高级进阶架构资料 帮助大家学习提升进阶,也可以分享给身边好友一起学习。

一起互勉~

《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》,点击传送门即可获取!

给我的,里面包含了腾讯、字节跳动、阿里、百度2019-2021面试真题解析,并且把每个技术点整理成了视频和PDF(知识脉络 + 诸多细节)。

还有 高级架构技术进阶脑图、高级进阶架构资料 帮助大家学习提升进阶,也可以分享给身边好友一起学习。

[外链图片转存中…(img-4S2V5Tns-1712214012471)]

[外链图片转存中…(img-wwdSwTeK-1712214012471)]

一起互勉~

《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》,点击传送门即可获取!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值