当前位置: 首页 > news >正文

西安网站建设交易指数基金排名前十名

西安网站建设交易,指数基金排名前十名,wordpress备份与恢复,公司oa办公平台从今天开始,我来分享一些关于Android的一些基础知识,感兴趣一起来学啊! 大学生交流群:728910358 目录 前言 二、相对布局RelativeLayout 三、 帧布局FrameLayout 前言 从今天开始,我准备分享我最近一年所学到的一些…

从今天开始,我来分享一些关于Android的一些基础知识,感兴趣一起来学啊!

大学生交流群:728910358

目录

前言

二、相对布局RelativeLayout

三、 帧布局FrameLayout


前言

从今天开始,我准备分享我最近一年所学到的一些Android基础知识,一方面为了巩固一下我的知识体系,还有一方面是方便各位CSDN有需求的小伙伴学习,接下来让我们一起来学习Android的第一次内容:基础布局容器


一、线性布局LinearLayout

线性布局就是从左到右或从上到下按顺序排列的一种布局。下面讲一讲 LinearLayout 的基础属性。

 效果展示

 android:orientation ="vertical"所有子视图纵向摆放

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center" //子视图相对父视图居中显示android:orientation="vertical"> //所有子视图纵向摆放<Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="普通按钮" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="普通按钮" /><Buttonandroid:layout_width="wrap_content"
android:layout_height="wrap_content"android:text="普通按钮" /><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="普通按钮" />
</LinearLayout>

 android:orientation ="horizontal"所有子视图横向摆放

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:gravity="center" //子视图相对父视图居中显示android:orientation="horizontal"> //所有子视图横向摆放......... 省略
</LinearLayout>

二、相对布局RelativeLayout

相对于父元素 7 个常用属性

 相对于兄弟元素 4 个常用属性

 相对于兄弟元素的对齐方式

 

 效果演示

 使用 layout_below 使得后面一个组件位于前面一个组件的下方,配合 layout_toRightOf 使得后面一个组件位于前面一个组件的右方。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><Buttonandroid:id="@+id/btn1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:text="普通按钮 1" /><Buttonandroid:id="@+id/btn2"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/btn1"android:layout_toRightOf="@+id/btn1"android:text="普通按钮 2" /><Buttonandroid:id="@+id/btn3"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/btn2"android:layout_toRightOf="@+id/btn2"android:text="普通按钮 3" /><Buttonandroid:id="@+id/btn4"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_below="@+id/btn3"android:layout_toRightOf="@+id/btn3"android:text="普通按钮 4" />
</RelativeLayout>

三、 帧布局FrameLayout

组件的默认位置都是左上角,组件之间可以重叠。像千层饼一样,一层压着一层可以设置上下左右的对齐、水平垂直居中、设置方式与线性布局相似。

常用属性

效果演示 

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><!-- android:background="@color/purple_200"设置文本的背景色android:gravity="center_horizontal" // 文本中的文字对齐方
式android:paddingTop="100dp" // 文本的上边内间距android:text="layout_gravity:center" // 现实的文本内容android:textSize="30dp" /> // 文本字号大小--><TextViewandroid:layout_width="match_parent"android:layout_height="match_parent"android:layout_gravity="center"android:background="@color/purple_200" android:gravity="center_horizontal" android:paddingTop="100dp" android:text="layout_gravity:center" android:textSize="30dp" /> <TextViewandroid:layout_width="300dp"android:layout_height="360dp"android:layout_gravity="center"android:background="@color/purple_500" /><TextViewandroid:layout_width="240dp"android:layout_height="240dp"android:layout_gravity="center"android:background="@color/purple_700" /><TextViewandroid:layout_width="140dp"android:layout_height="140dp"android:layout_gravity="center"android:background="@color/teal_700" /><TextViewandroid:layout_width="60dp"android:layout_height="60dp"android:layout_gravity="center"android:background="#ffffff"android:gravity="center" />
</FrameLayout>

 总结

http://www.lbrq.cn/news/2698813.html

相关文章:

  • 做调查网站怎样换IP网站链接分析工具
  • 企业网站制作优化百度搜索
  • 江门seo网站排名短视频营销
  • 做网站 用什么语言百度收录情况查询
  • 建企业网站东莞百度快速优化排名
  • 石狮网站建设价格全网营销推广怎么做
  • 公司内部网站维护微信广告推广价格表
  • 如何自主建设企业网站网络营销怎么做
  • 四川建设网官方网站网站建设流程
  • 企业网站建设原则百度商家入驻
  • 实体行业做分销网站有什么好处知乎推广合作
  • 做详情页的网站专业网站推广引流
  • 前端设计除了做网站还能做什么郑州关键词优化费用
  • 洪梅镇仿做网站网络营销是做什么
  • 东阳网站建设方案做网站用什么软件
  • 网站模板源代码手游cpa推广平台
  • 贵阳网站开发最新搜索引擎排名
  • 瓯北网站制作系统百度搜图
  • 做宣传册参考网站郑州整站关键词搜索排名技术
  • 建设商务网站需要哪些步骤seo服务价格表
  • wordpress开启伪静态找不到页面烟台seo
  • 海南的网站建设公司搜索引擎优化策略不包括
  • 微信公众号做电影网站长春网站建设推广
  • 苏州安岭网站建设公司电商网站seo优化
  • 怀化平台免费网站建设seo
  • 电子商务网站建设规划范文google登录入口
  • 电脑做ppt一般下载哪个网站好少儿编程
  • wordpress翻页404关键词优化的主要工具
  • 北京网站制作公司兴田德润在那里智能建站模板
  • 怎么做推广和宣传企业做网站搜索关键词是什么意思
  • 更改webpack默认配置项
  • PCBA:电子产品制造的核心环节
  • 开源日志log4cplus—调用MultiByteToWideChar提示未定义,CP_UTF8未定义定原因有哪些,如何改进?
  • windows git安装步骤
  • Tauri Qt孰优孰劣
  • SQL Server增加对UTF-8的支持