android - 怎麼把圖片設定在兩個佈局的邊緣上
淡淡烟草味
淡淡烟草味 2017-05-16 13:34:07
0
2
816

#如圖怎麼設定這樣的效果,圖片在兩個佈局邊緣上這個activity下面有一個正在播放影片的activity,我用幀佈局已設定透明就全透明了。

淡淡烟草味
淡淡烟草味

全部回覆(2)
習慣沉默

不知道是不是這個效果

代碼:

<?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:background="@android:color/holo_green_dark"
    android:clipChildren="false">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:background="@android:color/darker_gray">
        <View
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"/>
        <ImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:layout_gravity="bottom"
            android:src="@mipmap/ic_launcher"/>
        <View
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"/>
    </LinearLayout>
</RelativeLayout>

關鍵在這句代碼:

android:clipChildren="false"

解釋:

是否限制子View在其範圍內 預設為true

PHPzhong

使用錨點。範例可以網路搜尋或是Studio中File-New-Activity-ScrollingActivity建立一個自備的預設模板,裡面版面就是

熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!