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 妈妈生日祝福语简短励志