inflate引入的布局高度不对问题
来源:互联网 发布:巴宝莉格子侵权淘宝 编辑:程序博客网 时间:2024/04/30 03:52
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:layout_height="@dimen/ios_public_space_90px"
android:orientation="horizontal" >
<View
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="1px"
android:layout_marginRight="@dimen/ios_public_space_40px"
android:background="@color/pub_color_eighteen" />
<TextView
android:layout_gravity="center"
android:layout_weight="0"
android:layout_width="wrap_content"
android:gravity="center"
android:text="android"
android:textColor="@color/pub_color_eighteen"
android:textSize="@dimen/ios_public_textsize_24pt" />
<View
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="1px"
android:layout_marginLeft="@dimen/ios_public_space_40px"
android:background="@color/pub_color_eighteen" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:layout_height="@dimen/ios_public_space_90px"
android:orientation="horizontal" >
<View
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="1px"
android:layout_marginRight="@dimen/ios_public_space_40px"
android:background="@color/pub_color_eighteen" />
<TextView
android:layout_gravity="center"
android:layout_weight="0"
android:layout_width="wrap_content"
android:gravity="center"
android:text="android"
android:textColor="@color/pub_color_eighteen"
android:textSize="@dimen/ios_public_textsize_24pt" />
<View
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="1px"
android:layout_marginLeft="@dimen/ios_public_space_40px"
android:background="@color/pub_color_eighteen" />
</LinearLayout>
引入这个布局后,我们会发现view绘制出来后高度与预期的是不一样的,并没有想象中的90px,如果想让整个view高度达到90px,可以在textview中加上android:layout_height="@dimen/ios_public_space_90px",因为最外层的的高度即使设置了也是wrap_content的,需要在内层布局中重新确认高度。
在此在说一句,有时我们想要隐藏引入的布局,但是setVisibility(View.GONE)却没有效果,我们可以在嵌套一层布局,给内层的布局设置GONE,这样就能成功隐藏了
1 0
- inflate引入的布局高度不对问题
- 布局显示不对的问题
- 关于Recyclerview的item指定高度却不对的问题
- 计算多行文字,高度展示不对的问题
- LayoutInflater的inflate方法引起的listview界面布局问题
- LayoutInflater的inflate方法引起的listview界面布局问题
- layout布局中的inflate导致属性失效的问题。
- inflate()参数的问题
- $(window).height()获取到的高度不对
- 自适应布局---高度问题
- 【android】LayoutInflater.inflate方法的详解及xml根元素的布局参数不起作用的问题
- 【android】LayoutInflater.inflate方法的详解及xml根元素的布局参数不起作用的问题
- Android LayoutInflater的inflate布局文件收获
- Unity3D-关于使用LayoutGroup自动布局后获取宽高不对的问题
- MoveWindow位置不对的问题
- 自动布局时高度算不准的问题
- listview条目布局中设置高度无效的问题
- 为什么我的设置的div最小高度不对
- 【学习】JavaScript设计模式——认识设计模式
- androidstudio安装注意事项(打不开的可能原因)
- 【Android】AsyncTask异步类
- TextView
- NPOI操作EXCEL 添加报文头(AddHeader)出现下载框
- inflate引入的布局高度不对问题
- android的apk加壳工具对比
- SQLSTATE=57016
- 我是如何利用一个周末时间成为前端工程师的
- iOS 集成微信支付
- 应用基本框架的搭建
- Ubuntu14.0.4系统如何获取root权限
- OpenCV基础优化之使用drawContours
- C++ -> 向量(vector)