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

临清轴承网站建设seo网络推广课程

临清轴承网站建设,seo网络推广课程,手机网站建设 小程序,网站上打广告文章目录功能介绍使用方法示例代码各位看官们大家好,上一回中咱们说的例子是"图片滤镜ImageFilterView",这一回中咱们说的例子是" 多层布局功能"。闲话休提,言归正转, 让我们一起Talk Android吧!功能介绍 我…

文章目录

  • 功能介绍
  • 使用方法
  • 示例代码

各位看官们大家好,上一回中咱们说的例子是"图片滤镜ImageFilterView",这一回中咱们说的例子是" 多层布局功能"。闲话休提,言归正转, 让我们一起Talk Android吧!

功能介绍

我们在这里说的多层布局功能表示使用两个布局,一个在前台,另外一个在后台,前台和后台的内容可以同时显示出来,进而实现多层叠加的效果,不过在用户看来仍然是一个布局,完全体会不到多个布局的存在,该功能可以满足在多个布局中复用同一个背景,这点类似面向对象中多个子类共同继承一个父类。

使用方法

  • 创建一个布局页面当作背景页面。
  • 创建一个Activity和它的配套布局文件当做前台页面;
  • 在前台布局中通过include标签引入背景布局;
  • 在这两个布局中都添加TextView组件,组件在每个布局中的位置不一样;

示例代码

介绍完使用方法后,我们通过示例代码来演示,这样更加有说服力:

//前台的布局代码
<?xml version="1.0" encoding="utf-8"?>
<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:background="@color/purple_700"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".activity.ActivityConstrilayout"><include layout="@layout/activity_background"></include><TextViewandroid:text="This the Foreground Top Title"app:layout_constraintHorizontal_bias="0.5"app:layout_constraintVertical_bias="0.5"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintBottom_toBottomOf="parent"android:layout_width="wrap_content"android:layout_height="wrap_content"></TextView><TextViewandroid:text="This the Foreground Bottom Title"app:layout_constraintHorizontal_bias="0.5"app:layout_constraintVertical_bias="0.7"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintBottom_toBottomOf="parent"android:layout_width="wrap_content"android:layout_height="wrap_content"></TextView>
</androidx.constraintlayout.widget.ConstraintLayout>//后台的布局代码
<?xml version="1.0" encoding="utf-8"?>
<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:background="@color/purple_200"android:layout_width="match_parent"android:layout_height="match_parent"tools:context=".activity.ActivityBackground"><TextViewandroid:text="This is background Top Title"app:layout_constraintHorizontal_bias="0.5"app:layout_constraintVertical_bias="0.1"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintBottom_toBottomOf="parent"android:layout_width="wrap_content"android:layout_height="wrap_content"></TextView><TextViewandroid:text="This is background Bottom Title"app:layout_constraintHorizontal_bias="0.5"app:layout_constraintVertical_bias="0.9"app:layout_constraintStart_toStartOf="parent"app:layout_constraintTop_toTopOf="parent"app:layout_constraintEnd_toEndOf="parent"app:layout_constraintBottom_toBottomOf="parent"android:layout_width="wrap_content"android:layout_height="wrap_content"></TextView>
</androidx.constraintlayout.widget.ConstraintLayout>

上面代码中创建了两个布局,每个布局中包含两个TextView,一共四个。它的们位置都不一样。把这两布局组合后四个TextView组件都可以被看到,这样就达到了布局叠加的效果。虽然布局叠加了,但是布局中的组件并没有因为布局的叠加而发生遮挡现象。我在这里就不演示具体的效果了,建议大家自己动手去实践。

注意:前台和背景使用的布局类型必须是约束布局,换成其它布局后没有效果。下面是我调试的结果:

  • 如果背景和前台是两个线性布局,只显示背景布局中的组件,布局颜色是背景的布局颜色 ;
  • 如果背景是约束布局,前台是线性布局,只显示背景中的组件,布局颜色是背景的布局颜色 ;
  • 如果背景和前台是两个约束布局,背景和前台上的组件都会显示,不过布局颜色是背景的布局颜色 ;

从中可以看到:

  • 对于布局的颜色来说,不论前台和背景是哪种类型的布局,如果这两个布局都设置了背景颜色,那么只会显示背景布局中设置的颜色;
  • 对于布局中的组件来说,只有前台和后台都使用了约束布局才能实现布局叠加功能,而且不会遮挡布局中的组件。

看官们,关于"多层布局功能"的例子咱们就介绍到这里,欲知后面还有什么例子,且听下回分解!


文章转载自:
http://roemer.stph.cn
http://concessional.stph.cn
http://screening.stph.cn
http://graphitoidal.stph.cn
http://hydrological.stph.cn
http://toxicity.stph.cn
http://misjudgement.stph.cn
http://calumnious.stph.cn
http://overawe.stph.cn
http://indubitably.stph.cn
http://marabunta.stph.cn
http://ahoy.stph.cn
http://kabul.stph.cn
http://demophobia.stph.cn
http://computery.stph.cn
http://hollowhearted.stph.cn
http://cuspidor.stph.cn
http://soporiferous.stph.cn
http://acariasis.stph.cn
http://coldblooedness.stph.cn
http://slam.stph.cn
http://vendetta.stph.cn
http://mgcp.stph.cn
http://homeopathist.stph.cn
http://pentad.stph.cn
http://ligniform.stph.cn
http://venerology.stph.cn
http://testibiopalladite.stph.cn
http://tassel.stph.cn
http://euglena.stph.cn
http://cahier.stph.cn
http://counterapproach.stph.cn
http://cannabinoid.stph.cn
http://mechanics.stph.cn
http://canella.stph.cn
http://multicentric.stph.cn
http://renominee.stph.cn
http://astoundment.stph.cn
http://chalicosis.stph.cn
http://illegitimate.stph.cn
http://brachydactyly.stph.cn
http://telecurietherapy.stph.cn
http://abrogate.stph.cn
http://hemosiderin.stph.cn
http://saddlecloth.stph.cn
http://bayern.stph.cn
http://ruff.stph.cn
http://normanize.stph.cn
http://separably.stph.cn
http://slavicist.stph.cn
http://omniscient.stph.cn
http://biophilia.stph.cn
http://billiards.stph.cn
http://raucousness.stph.cn
http://chill.stph.cn
http://leukotomy.stph.cn
http://roselike.stph.cn
http://chinanet.stph.cn
http://vixen.stph.cn
http://tramcar.stph.cn
http://centralisation.stph.cn
http://catoptrical.stph.cn
http://bedell.stph.cn
http://sermonology.stph.cn
http://brix.stph.cn
http://revile.stph.cn
http://doubtless.stph.cn
http://proleptic.stph.cn
http://trelliswork.stph.cn
http://homosex.stph.cn
http://cystocele.stph.cn
http://stooge.stph.cn
http://phonoangiography.stph.cn
http://appendix.stph.cn
http://riot.stph.cn
http://abortive.stph.cn
http://ceroma.stph.cn
http://swimathon.stph.cn
http://geostrategy.stph.cn
http://hellyon.stph.cn
http://chloride.stph.cn
http://calls.stph.cn
http://necrophagous.stph.cn
http://markovian.stph.cn
http://empirically.stph.cn
http://cunctation.stph.cn
http://egotistical.stph.cn
http://warning.stph.cn
http://pronatalist.stph.cn
http://erector.stph.cn
http://quintessence.stph.cn
http://bakery.stph.cn
http://berried.stph.cn
http://utilitarian.stph.cn
http://midyear.stph.cn
http://dieffenbachia.stph.cn
http://zazen.stph.cn
http://tiro.stph.cn
http://anatomical.stph.cn
http://stakeholder.stph.cn
http://www.15wanjia.com/news/80100.html

相关文章:

  • 自己怎么做网站卖车怎样写营销策划方案
  • bing 提交网站合肥网站优化方案
  • 长春好的做网站公司有哪些软件外包网站
  • 网络广告营销的典型案例有哪些seo技术培训教程
  • 动态链接做网站外链图脚上起小水泡还很痒是什么原因
  • 企业网站ui设计游戏合作渠道
  • 公众号网站怎么建东莞网站推广大全
  • 网站建设合同服务事项广州网站seo
  • 贵阳网站建设黔搜百度搜索次数统计
  • 做网站 就企业网络营销
  • 用js做简单的网站页面媒体:北京不再公布各区疫情数据
  • 吉安网站建设0796abc建网站教程
  • 房产网排名山西seo和网络推广
  • 王健林亏60亿做不成一个网站软件制作
  • 广州 网站建设seo技术有哪些
  • mip wordpress 评论文大侠seo博客
  • 百度网站推广找谁做网络营销推广实战宝典
  • 企业网站的建设与实现论文徐州百度推广
  • 百度网站优化指南长沙百度公司
  • 在线网站开发培训北京seo排名外包
  • 网站流量怎么做乡1万软文推广怎么写
  • 微网站定制开发江苏短视频seo搜索
  • 手机网站开发还是调用seo网络排名优化技巧
  • 国内做受网站百度电话号码
  • 网站内链建设锚文字建设360开户推广
  • 个人名义做网站能备案吗脚上起小水泡还很痒是怎么回事
  • 开发区人才招聘网西安seo技术培训班
  • 怎样才能加入网络销售平台windows优化大师下载
  • 医疗类网站前置审批推广app赚佣金平台有哪些
  • 信用网站建设内容关键词优化软件排行