stroke
:是描边属性,可以定义描边的宽度
、颜色
、虚实线
等。
<stroke
android:width=“1dp” // 描边的宽度
android:color=“#ff0000” // 描边的颜色
// 以下两个属性设置虚线
android:dashWidth=“1dp” // 虚线的宽度,值为0时是实线
android:dashGap=“1dp” /> // 虚线的间隔
padding
:用来定义内部边距。
<padding
android:left=“10dp” // 左内边距;
android:top=“10dp” // 上内边距;
android:right=“10dp” // 右内边距;
android:bottom=“10dp” /> // 下内边距。
size
:用来定义图形的大小的。
<size
android:width=“50dp” // 宽度
android:height=“50dp” /> // 高度
Shape
特殊属性可以定义当前Shape
的形状,比如矩形
、椭圆形
、线形
、环形
… 这些都是通过Shape
标签属性。
<shape xmlns:android=“http://schemas.android.com/apk/res/android”
android:shape=[“rectangle” | “oval” | “line” | “ring”] // Shape 的形状,默认为矩形,可以设置为矩形(rectangle)、椭圆形(oval)、线性形状(line)、环形(ring)
// 下面的属性只有在 android:shape=“ring” 时可用:
android:innerRadius=“10dp” // 内环的半径
android:innerRadiusRatio=“2” // 浮点型,以环的宽度比率来表示内环的半径
android:thickness=“3dp” // 环的厚度
android:thicknessRatio=“2” // 浮点型,以环的宽度比率来表示环的厚度
android:useLevel=“false”> // boolean 值,如果当做是 LevelListDrawable 使用时值为 true,否则为 false。
rectangle
:矩形
<shape xmlns:android=“http://schemas.android.com/apk/res/android”
android:shape=“rectangle”>
oval
:椭圆
<shape xmlns:android=“http://schemas.android.com/apk/res/android”
android:shape=“oval”>
line
:线
<shape xmlns:android=“http://schemas.android.com/apk/res/android”
android:shape=“line”>
<stroke
android:width=“1dp”
android:color=“@color/colorAccent”
android:dashGap=“3dp” // 虚线间距
android:dashWidth=“4dp” /> // 虚线宽度
ring
:圆环
<shape xmlns:android=“http://schemas.android.com/apk/res/android”
android:shape=“ring”
android:useLevel=“false”
android:innerRadius=“20dp” // 内环的半径
android:thickness=“10dp”> // 圆环宽度
Shape
文件新建在res/drawable
文件夹下,例如shape_text.xml
shape_text.xml
<gradient
android:angle=“90”
android:endColor=“#fcf”
android:startColor=“#cff”/>
<padding
android:left=“20dp”
android:top=“20dp”
android:right=“20dp”
android:bottom=“20dp”/>
- 布局中使用
<androidx.constraintlayout.widget.ConstraintLayout 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”
tools:context=“.MainActivity”>
<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:orientation=“vertical”
android:gravity=“center”>
<TextView
android:id=“@+id/dzm”
android:layout_width=“300dp”
android:layout_height=“300dp”
android:text=“@string/app_name”
android:textSize=“50sp”
android:background=“@drawable/shape_text” />
最后
一线互联网Android面试题含详解(初级到高级专题)
这些题目是今年群友去腾讯、百度、小米、乐视、美团、58、猎豹、360、新浪、搜狐等一线互联网公司面试被问到的题目。并且大多数都整理了答案,熟悉这些知识点会大大增加通过前两轮技术面试的几率
如果设置门槛,很多开发者朋友会因此错过这套高级架构资料,错过提升成为架构师的可能。这就失去了我们的初衷;让更多人都能通过高效高质量的学习,提升自己的技术和格局,升职加薪。
最后送给大家一句话,望共勉,永远不要放弃自己的梦想和追求;
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
、360、新浪、搜狐等一线互联网公司面试被问到的题目。并且大多数都整理了答案,熟悉这些知识点会大大增加通过前两轮技术面试的几率
[外链图片转存中…(img-oGT4aEpq-1714128119954)]
如果设置门槛,很多开发者朋友会因此错过这套高级架构资料,错过提升成为架构师的可能。这就失去了我们的初衷;让更多人都能通过高效高质量的学习,提升自己的技术和格局,升职加薪。
最后送给大家一句话,望共勉,永远不要放弃自己的梦想和追求;
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!