看4.2的DeskClock源码,看到了一个布局,如下:
底部是透明的Footer,按照习惯的思维肯定是使用FrameLayout或者RelativeLayout,但是Android源码中使用的是LinearLayout,下面的Footer的Margin设置为-48,这样就能漂浮在上面了。真是妙啊!
<LinearLayout
android:id="@+id/desk_clock"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ListView
android:id="@+id/cities"
android:clickable="false"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"/>
<FrameLayout
android:id="@+id/clock_footer"
android:layout_marginTop="@dimen/button_footer_height_neg"
android:background="@drawable/footer_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content">