线性布局上的一个小错误
今天做一个demo测试,在一个布局上花费了一点时间
想想自己感到也是可笑,在这里记录下,自己要布局的效果
大致如下
在布局的图中做的效果是
这样的
下面是部分布局代码
<RelativeLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content" ><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="15dp"android:background="@null"android:text="12-16 16:42"android:textColor="#000000"android:textSize="12sp" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:layout_marginRight="70dp"android:orientation="horizontal" ><ImageViewandroid:layout_width="15dp"android:layout_height="15dp"android:adjustViewBounds="true"android:layout_marginLeft="10dp"android:src="@drawable/ic_launcher" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="35"android:layout_marginRight="10dp"android:textColor="#000000"android:textSize="12sp" /></LinearLayout><LinearLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:layout_marginRight="20dp"android:orientation="horizontal" ><ImageViewandroid:layout_width="15dp"android:layout_height="15dp"android:adjustViewBounds="true"android:src="@drawable/ic_launcher" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="评论"android:textColor="#000000"android:textSize="12sp" /></LinearLayout></RelativeLayout>
感觉也没有什么错误呢为什么移动不过去呢,我这个方面纠结了半天
最后呢看效果图才知道哪里处错误了
效果图:
我又把整体和里面的内容搞混了,我的移动是的线性布局里面的内容
自己把线性布局的宽度设置为match_parent, 想到这里,我把这个宽度
设置wrap_content ,这个问题是自己做布局的时候对于一些宽度没有限制的
总是习惯设置成match_parent,还有的是自己在基础自己还是不够牢固
总是感觉自己什么都会,其实自己太自负了,这个记录希望能提醒自己
最后贴上全部代码,希望对android新手有点帮助
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"android:layout_width="match_parent"android:orientation="vertical"android:layout_height="wrap_content"android:layout_margin="5dp">
<!-- <TextViewandroid:id="@+id/textView"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_centerHorizontal="true"android:layout_centerVertical="true"android:textColor="#ffffff"android:textAppearance="?android:attr/textAppearanceLarge" /> --><ImageViewandroid:id="@+id/recyclerviewtest"android:layout_width="wrap_content"android:layout_height="wrap_content"android:scaleType="center"android:adjustViewBounds="true"android:src="@drawable/ic_launcher"/><RelativeLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginTop="10dp"> <com.example.recyclerviewtest.CircleImageViewandroid:layout_width="40dp"android:layout_height="40dp"android:layout_marginLeft="10dp"android:src="@drawable/ic_launcher"app:border_width="0.5dp"app:border_color="#000000"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Baby"android:textColor="#000000"android:layout_marginLeft="60dp"/><ImageViewandroid:layout_width="wrap_content"android:layout_height="15dp"android:adjustViewBounds="true"android:src="@drawable/ic_launcher"android:layout_marginLeft="90dp"/><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="60dp"android:layout_marginTop="20dp"android:orientation="horizontal"><ImageViewandroid:layout_width="wrap_content"android:layout_height="15dp"android:adjustViewBounds="true"android:src="@drawable/ic_launcher"android:paddingRight="8dp"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="白领"android:textColor="#000000"android:paddingRight="8dp"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="发呆ing"android:textColor="#000000"android:paddingRight="8dp"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="甜美"android:textColor="#000000"android:paddingRight="8dp"/></LinearLayout><ImageViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@drawable/ic_launcher"android:adjustViewBounds="true"android:layout_alignParentRight="true"android:layout_marginRight="20dp"/> </RelativeLayout><Viewandroid:layout_width="match_parent"android:layout_height="1dp"android:background="#330000"/><TextViewandroid:layout_width="match_parent"android:layout_height="wrap_content"android:text="今天的拿铁特别好喝,心情超级好!"android:textColor="#000000"android:textSize="12sp"/><RelativeLayoutandroid:layout_width="match_parent"android:layout_height="wrap_content" ><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_marginLeft="15dp"android:background="@null"android:text="12-16 16:42"android:textColor="#000000"android:textSize="12sp" /><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:layout_marginRight="70dp"android:orientation="horizontal" ><ImageViewandroid:layout_width="15dp"android:layout_height="15dp"android:adjustViewBounds="true"android:layout_marginLeft="10dp"android:src="@drawable/ic_launcher" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="35"android:layout_marginRight="10dp"android:textColor="#000000"android:textSize="12sp" /></LinearLayout><LinearLayoutandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_alignParentRight="true"android:layout_marginRight="20dp"android:orientation="horizontal" ><ImageViewandroid:layout_width="15dp"android:layout_height="15dp"android:adjustViewBounds="true"android:src="@drawable/ic_launcher" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="评论"android:textColor="#000000"android:textSize="12sp" /></LinearLayout></RelativeLayout></LinearLayout>
希望大家给指点下,这个布局怎样。
线性布局上的一个小错误相关推荐
- 使用css选择器容易犯的一个小错误
使用css选择器容易犯的一个小错误 比如说,当我们使用scrapy框架的时候,想要利用find_element_by_css_selector()方法来找出网页中对应的部分,比如说下图所示的登陆框. ...
- 从Blue Pill、硬件虚拟化谈安全防护完备性上的一个小原则
这篇博客说说一个安全防护系统完备性上所需的一个小原则:防护系统与被防护对象所用资源的完全隔离,包括防护系统自身工作所依赖的资源不能依赖被防护对象.听起来是原理很简单的一个点,实现中往往很复杂.例如操作 ...
- CVS代码管理的一个小错误
前两天去北京参加open day了,客户需要我上传一个文件,在火车上用手机建立了临时热点,却怎么也上传不了,到了酒店居然还是上传不了,一直提示错误 Unable to initialize the C ...
- 工作中发现的相对布局中的一个小技巧
大家都知道,我们在配置布局xml文件的时候,都需要考虑该布局在横竖屏不同状态下的显示样式,尽可能的将一个xml文件即适应于横屏,又适应于竖屏.这就要求在xml文件中尽量少使用类似于"50di ...
- 我的背上有一个小虫子,提醒我纠正姿势
最后坐直了-可以将嗡嗡声感应在你的背上,并在手机上使用一个应用程序吗? 后面的虫子嗡嗡作响,要我坐直. 或者更确切地说,一个贴在我的肩shoulder骨之间的皮肤上的拇指大小的塑料盒会振动. 盒子坐在 ...
- 1、Android开发-使用Android Studio 布局编辑器编写一个小例子
做为Android 初学者,不管是您从事的是混合移动开发还是原生开发,我认为,学习一下Android UI是非常有必要的.Android stuido 的强大特性可以使用布局编辑器来进行开发界面,以了 ...
- [vSphere培训实录]利用模板部署虚拟机时的一个小错误
今天尝试用template deploy一个虚拟机,试图自定义Guest OS设置时,出现这样的错误: 很是苦恼啊,我白天试过用vmware converter做过P2V,也自定义过Guest OS, ...
- mysql触发器学习的一个小错误
mysql> create trigger trigger_5 after insert on department for each row drop table name; mysql> ...
- 记conda 安装geopandas遇到的一个小错误
说实话conda确实很好用,今天用它安装geopandas后import时遇到一个错误:libgeos-3.5.0.so: cannot open shared object file: No suc ...
最新文章
- YOLOv4实用训练实践
- 记录一次OOM分析过程
- dedecms 文章回收站 记得及时清理
- 关于迭代測试的一些思考
- .NET Core TLS 协议指定被我钻了空子~~~
- 2、赶去公司--网易2017春招
- eclipse中maven项目pom文件第一行报错解决方法
- python之将python代码编译成.so
- node在Fedora 22系统下开发环境搭建
- 二级计算机中一级标题设置,如何编辑目录中一级标题二级标题的不同格式
- 饥荒联机云服务器_饥荒steam联机版专用服务器搭建
- python画图分析问卷(含多选题)
- 微信加拿大服务器,微信新功能,在加拿大也可以任意刷人民币了
- 股票技术指标详解--移动平均线(MA)
- DM达梦数据库使用druid时提示:dbType not support : dm
- 庄家出货前兆的五种情况
- 深度学习经典卷积神经网络之VGGNet
- MIGO 行项目屏幕自定义字段增强示例
- 团体程序设计天梯赛——L1-054 福到了
- 软件和教堂非常相似——完工之后我们就开始祈祷
热门文章
- 自建WIN10 FTP无法访问的解决方法
- 2022-2028年中国汽车印制电路板(汽车PCB)产业深度调研及投资前景预测报告
- 2022-2028年中国汽车橡胶密封件行业市场深度分析及发展趋势分析报告
- windows安装MongoDB环境以及在pycharm中配置可视化插件
- 利用exchangelib快速上手使用python发邮件
- python特性(八):生成器对象的send方法
- HiCar基本功能介绍
- 2021年大数据Spark(十五):Spark Core的RDD常用算子
- Multiple substitutions specified in non-positional format; did you mean to add the formatted=”false”
- Glide 加载图片不显示(Android9.0无法加载图片)