美文网首页
安卓小技巧

安卓小技巧

作者: StoneWay3 | 来源:发表于2018-05-21 10:45 被阅读0次

1.  标题的空格:

如果想要两个字和三个字对齐的话,不妨试试\u3000,举个栗子:android:text="邮\u3000箱:"android:text="手机号:"显示效果是两个一样长

2.安卓写代码的时候有些图片、文字等等我们只是用来站位或者先试一下效果,但是我们并不想在运行的时候出现,这个时候可以用tool:

(1)

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

<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical"

    tools:context=".MainActivity">

        android:layout_width="match_parent"

        android:layout_height="match_parent"

        android:gravity="center"

        android:text="运行的时候可见"

        tools:text="编写代码的时候可以看见" />

</androidx.appcompat.widget.LinearLayoutCompat>

tools:text="编写代码的时候可以看见" 

(2).编译效果图

编辑的时候的预览页面

(3).运行的效果图

运行的效果

相关文章

网友评论

      本文标题:安卓小技巧

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