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

网站之间如何交换友情链接/新媒体营销六种方式

网站之间如何交换友情链接,新媒体营销六种方式,网页设计叫什么岗位,wordpress怎么使用插件android的线性布局linearlayout的研究没有尽头。看了官网关于线性布局的一个例子&#xff0c;捣鼓一阵&#xff0c;发现的迷惑记录在此。一、先看看官网xml <?xml version"1.0" encoding"utf-8"?><LinearLayout xmlns:android"http://sche…
android的线性布局linearlayout的研究没有尽头。看了官网关于线性布局的一个例子,捣鼓一阵,发现的迷惑记录在此。

一、先看看官网xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation
="vertical"
android:layout_width
="fill_parent"
android:layout_height
="fill_parent">

<LinearLayout
android:orientation="horizontal"
android:layout_width
="fill_parent"
android:layout_height
="fill_parent"
android:layout_weight
="1">
<TextView
android:text="red"
android:gravity
="center_horizontal"
android:background
="#aa0000"
android:layout_width
="wrap_content"
android:layout_height
="fill_parent"
android:layout_weight
="1"/>
<TextView
android:text="green"
android:gravity
="center_horizontal"
android:background
="#00aa00"
android:layout_width
="wrap_content"
android:layout_height
="fill_parent"
android:layout_weight
="1"/>
<TextView
android:text="blue"
android:gravity
="center_horizontal"
android:background
="#0000aa"
android:layout_width
="wrap_content"
android:layout_height
="fill_parent"
android:layout_weight
="1"/>
<TextView
android:text="yellow"
android:gravity
="center_horizontal"
android:background
="#aaaa00"
android:layout_width
="wrap_content"
android:layout_height
="fill_parent"
android:layout_weight
="1"/>
</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width
="fill_parent"
android:layout_height
="fill_parent"
android:layout_weight
="1">
<TextView
android:text="row one"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="row two"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="row three"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="row four"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
</LinearLayout>

</LinearLayout>

不难理解。统大者线性布局沾满整个屏幕,里面又有两个线性布局,它们的高宽度是沾满统大者线性布局,也就是说,它们两位也是要沾满整个屏幕,你不觉得矛盾吗?看看效果图,你会更矛盾:

我们预期看到的图应该是这样:第一个子线性布局完全沾满整个屏幕,因此,该图应该满屏幕都是红绿蓝黄,可是它居然与第二个子线性布局平起平坐,不觉得很奇怪吗?

我仔细看了xml文件,发现两个子线性布局各加了一个属性:weight="1"。1表示两个子线性布局平分整个屏幕,这就明白了,但是仍然给人一种别扭的感觉。我将xml文件修改如下:

二、我的xml文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation
="vertical"
android:layout_width
="fill_parent"
android:layout_height
="fill_parent">

<LinearLayout
android:orientation="horizontal"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content">
<TextView
android:text="red"
android:gravity
="center_horizontal"
android:background
="#aa0000"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="green"
android:gravity
="center_horizontal"
android:background
="#00aa00"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="blue"
android:gravity
="center_horizontal"
android:background
="#0000aa"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="yellow"
android:gravity
="center_horizontal"
android:background
="#aaaa00"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content">
<TextView
android:text="row one"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="row two"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="row three"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="row four"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
</LinearLayout>

</LinearLayout>

效果如下

天,发生了什么!

我将第一个子线性布局高调整为适可而止,子元素也是;第二个子线性布局也是,显示出来是这个戳样,我才明白官网为什么会那么做。

官网要显示美观,要让两个子线性平分屏幕,怎么平分,不可能靠着子元素的字体去平分(我就是让子线性跟着字体变化而适可而止),所以靠着weight来平分。

三、我的另一个xml文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation
="vertical"
android:layout_width
="fill_parent"
android:layout_height
="fill_parent">

<LinearLayout
android:orientation="horizontal"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1">
<TextView
android:text="red"
android:gravity
="center_horizontal"
android:background
="#aa0000"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="green"
android:gravity
="center_horizontal"
android:background
="#00aa00"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="blue"
android:gravity
="center_horizontal"
android:background
="#0000aa"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="yellow"
android:gravity
="center_horizontal"
android:background
="#aaaa00"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
</LinearLayout>

<LinearLayout
android:orientation="vertical"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1">
<TextView
android:text="row one"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="row two"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="row three"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
<TextView
android:text="row four"
android:textSize
="15pt"
android:layout_width
="fill_parent"
android:layout_height
="wrap_content"
android:layout_weight
="1"/>
</LinearLayout>

</LinearLayout>

我就改了两个地方,分别在两个子线性布局加上属性weight=1,显示的效果:

貌似是平分了,不过平分的不明显。

转载于:https://www.cnblogs.com/itblog/p/7236644.html

http://www.jmfq.cn/news/4751659.html

相关文章:

  • 网站建设一流公司/学历提升哪个教育机构好一些
  • 网站设计建设公司/短视频运营公司
  • django 网站开发案例/站长工具seo综合查询分析
  • wordpress短网址/湖南百度seo
  • wordpress 干什么/搜索引擎优化包括哪些
  • 自己做网站不用WordPress/专业seo外包
  • 成都企业网站的建立/培训学校招生营销方案
  • 备案博客域名做视频网站会怎么样/国内最好的危机公关公司
  • 初中做网站软件/网站运营指标
  • 免费注册店铺位置/抖音seo培训
  • 网站后台登陆验证码不显示/郑州百度seo
  • 网站建设概念股/百度推广公司怎么代理到的
  • 广州番禺区房价/网络营销企业网站优化
  • 品牌的手机网站制作/网络营销的特点主要包括什么
  • 建设网站需要的硬件设备/爱用建站
  • 包头做网站的/手机百度2020最新版
  • 字母logo设计生成器/电商网站seo怎么做
  • 珠海pc网站建设/惠州网站建设方案推广
  • 美国人做网站/全网搜索指数
  • 重庆妇科医院推荐/百度seo发包工具
  • 网站怎么做拉新/网站秒收录工具
  • 随州公司做网站/关键词优化推广排名软件
  • 公司自己做网站/深圳百度seo怎么做
  • wordpress直接上传视频网站/sem竞价推广托管
  • 宿迁西楚房产网/深圳市企业网站seo营销工具
  • 豪禾创意海报设计理念/济南seo培训
  • 临海手机网站/电商还有发展前景吗
  • 智慧团建学生登录入口手机版/宁波受欢迎全网seo优化
  • 荥阳市城乡规划和建设局网站/好的在线crm系统
  • 建网站收费吗/最强大的搜索引擎