zoukankan      html  css  js  c++  java
  • 个人经验

    Android的RelativeLayout布局的layout_height属性设置为wrap_content时的坑:

    此坑出现的条件:

    1.RelativeLayout布局的layout_height属性设置为wrap_content

    2.某“居中View”设置为layout_centerX(layout_centerVertical、layout_centerHorizontal、layout_centerInParent)

    3.其它View相对于“居中View”做布局

    此时坑出现了:

    无论其它View设置了在“居中View”的下方(layout_below、layout_below)、上方(layout_above)、底部对齐(layout_alignBottom)等等,通通无效!

    填坑方案:

    RelativeLayout布局的layout_height属性设置为match_parent即可!

    即使外层有LinearLayout使用layout_weight平分空间,它的match_parent也不会撑大外层LinearLayout的空间的。

    当初想设置wrap_content,其实就是怕内部的RelativeLayout设置match_parent后会被撑大而已,实践证明,多虑了!

    作者:Asion Tang
    凡是没有注明[转载]的文章,本Blog发表的文章版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
  • 相关阅读:
    框架
    css样式表。作用是美化HTML网页.
    表单的制作
    表格的制作
    常用标签的制作
    标签的制作
    poj2104(K-th Number)
    Codeforces Round #359 (Div. 2) D. Kay and Snowflake
    Codeforces Round #359 (Div. 2) C. Robbers' watch
    HDU3308(LCIS) 线段树好题
  • 原文地址:https://www.cnblogs.com/AsionTang/p/4029446.html
Copyright © 2011-2022 走看看