`

android 顶部和底部布局透明化

 
阅读更多
    使用RelativeLayout布局做成顶部和底部透明,设置如下:

<?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">

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- 顶部布局 -->
    <RelativeLayout
        android:id="@+id/header"
        android:layout_width="match_parent"
        android:layout_height="@dimen/display_photo_bottom_height"
        android:layout_alignParentTop="true"
        android:background="#ac080808">

    </RelativeLayout>

    <!-- 底部布局 -->
    <RelativeLayout
        android:id="@+id/footer"
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:layout_alignParentBottom="true"
        android:background="#ac080808">

    </RelativeLayout>

</RelativeLayout>



   位置不能出现错位,如果先把header放上面,后面的会把前面的部分覆盖,类似CSS的3D模型
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics