美文网首页
Android 自总结的一些小细节

Android 自总结的一些小细节

作者: yzzCool | 来源:发表于2019-01-12 00:03 被阅读8次

前言

TextView是安卓开发人员接触最早的控件,Android Studio新建一个默认工程,进入之后展现在我们面前的就是Hello World,呈现这个文字的控件就是TextView。本文只是说一说一些应用。

相关的使用

1.行间距和字间距控制

说到这两个东西接触的还真没有这么多,但是文字距离的太近就是不好看。

行间距:行间距用android:lineSpacingExtra=“”或者setLineSpacing(float add, float mult)
字间距:android:letterSpacing=“”或者setLetterSpacing(float letterSpacing)

1.1 行间距,直接上代码:

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="标识号会被烧入终端里,并且不能被修改。可用来对移动式设备进行身份识别和跟踪。由于ESN号段是有限的资源,基本上耗尽,可能还有少量回收利用的号段,所以制定了56bits的MEID号段,用来取代32bits的ESN号段。" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginTop="5dp"
            android:background="@color/colorAccent" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:lineSpacingExtra="1dp"
            android:text="标识号会被烧入终端里,并且不能被修改。可用来对移动式设备进行身份识别和跟踪。由于ESN号段是有限的资源,基本上耗尽,可能还有少量回收利用的号段,所以制定了56bits的MEID号段,用来取代32bits的ESN号段。" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginTop="5dp"
            android:background="@color/colorAccent" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:lineSpacingExtra="5dp"
            android:text="标识号会被烧入终端里,并且不能被修改。可用来对移动式设备进行身份识别和跟踪。由于ESN号段是有限的资源,基本上耗尽,可能还有少量回收利用的号段,所以制定了56bits的MEID号段,用来取代32bits的ESN号段。" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginTop="5dp"
            android:background="@color/colorAccent" />

    </LinearLayout>

得到的效果图如下:


行间距

很明显上面3段是不同的。

1.2 字间距,直接上代码:

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="标识号会被烧入终端里,并且不能被修改,默认" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:letterSpacing="-0.1"
            android:text="标识号会被烧入终端里,并且不能被修改,-0.1" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:letterSpacing="0.0"
            android:text="标识号会被烧入终端里,并且不能被修改,0.0" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:letterSpacing="0.1"
            android:text="标识号会被烧入终端里,并且不能被修改,0.1" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:letterSpacing="0.2"
            android:text="标识号会被烧入终端里,并且不能被修改,0.2" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:letterSpacing="0.3"
            android:text="标识号会被烧入终端里,并且不能被修改,0.3" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:letterSpacing="0.4"
            android:text="标识号会被烧入终端里,并且不能被修改,0.4" />
    </LinearLayout>

得到的效果如下图所示:


字间距

很明显写入不同的值,字体之间的间距,就是不同。注意:如果是负值,就有向里缩的感觉。

2.android color 透明度列表

这个就是自己的一个总结:总是要查找,不如自己记录一下。哈哈
下面的显示就是不透明度,记住不透明度!!!

0% 00
1% 03 11% 1C 21% 36 31% 4F 41% 69 51% 03 61% 1C 71% 36 81% 4F 91% 69
2% 05 12% 1F 22% 38 32% 52 42% 6B 52% 85 62% 9E 72% B8 82% D1 92% EB
3% 08 13% 21 23% 3B 33% 54 43% 6E 53% 87 63% A1 73% BA 83% D4 93% ED
4% 0A 14% 24 24% 3D 34% 57 44% 70 54% 8A 64% A3 74% BD 84% D6 94% F0
5% 0D 15% 26 25% 40 35% 59 45% 73 55% 8C 65% A6 75% BF 85% D9 95% F2
6% 0F 16% 29 26% 42 36% 5C 46% 75 56% 8F 66% A8 76% C2 86% DB 96% F5
7% 12 17% 2B 27% 45 37% 5E 47% 78 57% 91 67% AB 77% C4 87% DE 97% F7
8% 14 18% 2E 28% 47 38% 61 48% 7A 58% 94 68% AD 78% C7 88% E0 98% FA
9% 17 19% 30 29% 4A 39% 63 49% 7D 59% 96 69% B0 79% C9 89% E3 99% FC
10% 1A 20% 33 30% 4D 40% 66 50% 80 60% 99 70% B3 80% CC 90% E6 100% FF

3.android 历史版本和对应的API Level

name 版本代号 API Level
Android 9.0 Pie(馅饼) 28
Android 8.1 Oreo(奥利奥) 27
Android 8.0 Oreo(奥利奥) 26
Android 7.1 Nougat(牛轧糖) 25
Android 7.0 Nougat(牛轧糖) 24
Android 6.0 Marshmallow(棉花糖) 23
Android 5.1 Lollipop(棒棒糖) 22
Android 5.0 Lollipop(棒棒糖) 21
Android 4.4W KitKat(奇巧) 20
Android 4.4 KitKat(奇巧) 19
Android 4.3 Jelly Bean(果冻豆) 18
Android 4.2 Jelly Bean(果冻豆) 17
Android 4.1 Jelly Bean(果冻豆) 16
Android 4.0.3-4.0.4 Ice Cream Sandwich(冰淇淋三明治) 15
Android 4.0-4.0.2 Ice Cream Sandwich(冰淇淋三明治) 14
Android 3.2 Honeycomb(蜂巢) 13
Android 3.1 Honeycomb(蜂巢) 12
Android 3.0 Honeycomb(蜂巢) 11
Android 2.3.3-2.3.7 Gingerbread(姜饼) 10
Android 2.3 - 2.3.2 Gingerbread(姜饼) 9
Android 2.2 - 2.2.3 Froyo(冻酸奶) 8
Android 2.1 Éclair(闪电泡芙) 7
Android 2.0.1 Éclair(闪电泡芙) 6
Android 2.0 Éclair(闪电泡芙) 5
Android 1.6 Donut(甜甜圈) 4
Android 1.5 Cupcake(纸杯蛋糕) 3
Android 1.1 2
Android 1.0 1

相关文章

  • Android 自总结的一些小细节

    前言 TextView是安卓开发人员接触最早的控件,Android Studio新建一个默认工程,进入之后展现在我...

  • Android 一些小细节

    1.Calling startActivity() from outside of an Activity con...

  • 分享Android面试中的一些小细节

    一 . 前言 前段时间,因为疫情影响团队极度缺人,连续面了不少同学,正好借此分享一下自己对面试的一些浅见。谨代表个...

  • Android IPC - Binder 学习总结

    转自Android IPC - Binder 学习总结 最近想学些Android Framework中的东西,必经...

  • ListView高级用法

    总结了一下,一些小属性,有奇效 分割线颜色 android:divider=“@anroid:color/dark...

  • 详解 - Builder模式

    “Android设计模式”这个系列主要是对Android项目中的设计模式进行分析总结,学习自《Android 源码...

  • 详解 - 单例模式

    “Android设计模式”这个系列主要是对Android项目中的设计模式进行分析总结,学习自《Android 源码...

  • 一些小细节

    他转脸看着江生说,“这是阿遇,我把他交给你,从今以后,你要拿命护着他。” 江生看了眼床边的杜遇,“杜先生放心,江生...

  • Android monkey测试小结

    本文转自 Android自动化测试--monkey详细到炸的总结一、Monkey简介:Monkey是Android...

  • Android事件分发之基础

    转载自Android事件分发之基础Android 事件分发机制是比较重要的一块内容,总结一下 Android 事件...

网友评论

      本文标题:Android 自总结的一些小细节

      本文链接:https://www.haomeiwen.com/subject/dkwkoftx.html