zoukankan      html  css  js  c++  java
  • RelativeLayout中include 控件覆盖重叠的问题

    RelativeLayout直接include另一个layout是会把include中的控件与当前layout中的控件覆盖重叠,经过查资料

    其中的include标签一定要加上(因为include中不指定这二个属性其他所有属性都无效)

    android:layout_height="wrap_content"       

    android:layout_width="match_parent" 

    二个属性并指定id属性android:id="@+id/head"  

    再在当前layout的控件中指定属性android:layout_below="@id/head" 代码如下

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
    
        tools:context="com.zhouwei.uitest.MainActivity">
    
        <include layout="@layout/title" android:id="@+id/head"
            android:layout_height="wrap_content"
            android:layout_width="match_parent" ></include>
    
        <TextView
            android:id="@+id/textView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="Hello World!"
            android:textColor="#FF0000"
        android:layout_below="@id/head"
        android:textSize="50px" />
    </RelativeLayout>
    没加前效果


    加了后

    
    
  • 相关阅读:
    第一章 第二节逻辑代数基础
    第一章 第一节数制与编码
    Altium Designer多原理图、PCB更新处理
    AD添加LOGO的方法
    XML中<beans>属性
    程序员值得学习的技术博客
    设计模式
    js分页实例
    Java构造和解析Json数据的方法
    H5+ 移动app学习之三 App离线存储
  • 原文地址:https://www.cnblogs.com/q149072205/p/5236154.html
Copyright © 2011-2022 走看看