Android RelativeLayout 相对布局
示例
RelativeLayout是一个ViewGroup以相对位置显示子视图的。默认情况下,所有子视图都绘制在布局的左上角,因此您必须使用中提供的各种布局属性来定义每个视图的位置RelativeLayout.LayoutParams。每个layout属性的值可以是一个布尔值(启用相对于父RelativeLayout的布局位置),或者是一个ID,该ID引用该布局中应针对其放置视图的另一个视图。
例:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@mipmap/ic_launcher" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:layout_toRightOf="@+id/imageView"
android:layout_toEndOf="@+id/imageView"
android:hint="@string/hint" />
</RelativeLayout>这是一个屏幕截图,看起来像这样:
热门推荐
10 结婚新娘妈妈祝福语简短
11 生日奇葩祝福语简短男
12 冬至祝福语简短精悍幽默
13 新年祝福语姨姨简短
14 虎年 粤语祝福语大全简短
15 简短结婚的祝福语大全
16 周岁生日祝福语简短唯美
17 侄儿恋爱的祝福语简短
18 简短的几句新年祝福语