Android——幀佈局管理器

運行結果

在這裏插入圖片描述

在佈局管理器上所設置的屬性

android:foreground前景圖像
android:foregroundGravity前景圖像的位置

android:foreground="@mipmap/aa"
android:foregroundGravity="center|right"

重疊正方形實例

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:foreground="@mipmap/aa"
    android:foregroundGravity="center|right"

    tools:context=".MainActivity">

    <TextView
        android:layout_width="300dp"
        android:layout_height="300dp"
        android:text="Hello World!Hello World!"
        android:textColor="#ffffff"
        android:background="#00ff00"
        android:layout_gravity="center"

        />
    <TextView
        android:layout_width="250dp"
        android:layout_height="250dp"
        android:text="Hello World!"
        android:textColor="#ffffff"
        android:background="#0077ff"
        android:layout_gravity="center"
        />
    <TextView
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:text="Hello!"
        android:textColor="#ffffff"
        android:background="#ff00ff"
        android:layout_gravity="center"
        />
</FrameLayout>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章