《第二行代碼》 第一章FrameLayout

它相對來說簡單很多,它叫幀佈局,但我更想叫它爲層疊佈局,用它做疊加效果

就一個屬性:android:layout_gravity

示例代碼:

<?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"
tools:context=".groupview.FrameLayoutActivity">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="300dp"
    android:src="@mipmap/img_apply_talent_bg"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/btn_bg"
    android:layout_gravity="center_horizontal"
    android:textColor="@color/white"
    android:text="中間"/>

</FrameLayout>  

效果圖:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章