Framelayout

Framelayout的布局是一层一层的显示上去的,按照xml中的framelayout下的一级子控件的先后顺序来进行从底到顶的排列,他们的起点都是左上角。

但是是集中我们希望改变某一层的位置可以利用

android:layout_gravity
android:layout_margin
来控制

右上角

<ImageButton
        android:id="@+id/composer_button_search"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right|top"
        android:layout_marginRight="15dp"
        android:layout_marginTop="10dp"
        android:background="@drawable/ic_launcher" />

底部横向铺满的布局

<RelativeLayout
        android:id="@+id/operate"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:layout_gravity="bottom"
        android:background="#55336699" >

        <ImageButton
            android:id="@+id/composer_button_search"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="55dp"
            android:background="@drawable/personal_center" />

        <ImageButton
            android:id="@+id/composer_button_search"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="46dp"
            android:background="@drawable/personal_center" />

        <ImageButton
            android:id="@+id/composer_button_search"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/composer_button_search"
            android:layout_centerInParent="true"
            android:background="@drawable/personal_center" />
    </RelativeLayout>

Done

原文地址:https://www.cnblogs.com/xingyyy/p/4169428.html