android:layout_height="match_parent"和android:layout_marginTop="100dp"同时作用

来源:互联网 发布:dnf 登陆器源码 编辑:程序博客网 时间:2024/05/19 23:19

如果同时设置android:layout_height="match_parent" 和 android:layout_marginTop,会怎么样?


xml文件

<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:id="@+id/activity_margi_top_test"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:paddingBottom="@dimen/activity_vertical_margin"    android:paddingLeft="@dimen/activity_horizontal_margin"    android:paddingRight="@dimen/activity_horizontal_margin"    android:paddingTop="@dimen/activity_vertical_margin"    android:background="@android:color/holo_green_light"    tools:context="com.peggy.winastest.MargiTopTest"><LinearLayout    android:layout_width="match_parent"    android:layout_height="match_parent"    android:layout_marginTop="100dp"    android:background="@android:color/holo_blue_light"></LinearLayout></RelativeLayout>


结果如下



说明,marginTop =100dp 的基础上填充parent。


0 0
原创粉丝点击