智慧并不产生于学历,而是来自对于知识的终生不懈的追求。这篇文章主要讲述Android Studio学习路程1——Introduction-to-XML-Coding相关的知识,希望能为你提供帮助。
前几天安装了android Studio这个软件,在网上搜了一些视频就学了一点东西。这次就介绍一下XML的使用。
首先来说一下这个布局:layout

文章图片
【Android Studio学习路程1——Introduction-to-XML-Coding】 layout放在res目录下面,layout有基本的布局:FrameLayout,LinearLayout(线性布局),TableLayout,RelativeLayout(比较常用),AbsoluteLayout

文章图片
在activity_main.xml里面的TextView里有:
android:layout_width="wrap_content"
android:layout_height="wrap_content"我们可以把它改为match_parent

文章图片

文章图片
match_parent表示让当前控件的大小和父布局的大小一样,也就是由父布局决定当前控件的大小;wrap_content表示让当前的控件大小能够刚好包含里面的内容,也就是由控件内容决定当前控件的大小。
(二) :

文章图片
可以在左边的栏里面选中你需要的东西比如buttom可以直接拖到右边“手机”上面,它的代码会自动发生变化:

文章图片
推荐阅读
- Android 的UI基础布局的学习
- Android Device Monitor中File Explorer无法获取文件目录问题
- android中常用的布局管理器
- 安卓学习02---room
- Android学习02
- Android的应用多语言开发
- Android 开发UI布局
- elasticsearch mappings之dynamic的三种状态
- 寒假安卓app开发学习记录