Wie kann man einen solchen Effekt einrichten? Das Bild befindet sich am Rand der beiden Layouts. Unterhalb dieser Aktivit?t habe ich das Rahmenlayout verwendet es ist v?llig transparent.
不知道是不是這個(gè)效果
代碼:
<?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>
關(guān)鍵在這句代碼:
android:clipChildren="false"
解釋?zhuān)?/p>
是否限制子View在其范圍內(nèi) 默認(rèn)為true
使用錨點(diǎn)。例子可以網(wǎng)上搜或者Studio中File-New-Activity-ScrollingActivity創(chuàng)建一個(gè)自帶的默認(rèn)模板,里面布局就是