2012-01-12 101 views

回答

3

你可以使用一個FrameLayout這樣的:

<?xml version="1.0" encoding="utf-8"?> 
    <FrameLayout 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent">  

     <android.view.SurfaceView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/preview" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"> 
     </android.view.SurfaceView> 

      <RelativeLayout android:layout_width="fill_parent" 
      android:layout_height="60dp" 
android:background="#FFFFFF" android:layout_alignParentBottom="true"> 

       <ImageView android:scaleType="centerCrop" android:src="@drawable/some_drawable" android:layout_centerInParent="true" android:clickable="true" 
         android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/my_button"/> 
     </RelativeLayout> 
    </FrameLayout> 

結束語在FrameLayout一切都簡單地堆放在SurfaceView的頂視圖的一種方式。使用類似的方法來添加取景器。