2013-02-23 31 views
2

我有一個小的應用程序與相機,我有一個設備,這不是一個問題,但如果我可以改變應用程序將提高很多美學。在框架中放一個按鈕.Layaout

我把活動的XML代碼:

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:id="@+id/layout"> 



    <FrameLayout 
     android:id="@+id/preview" 
     android:layout_weight="1" 
     android:layout_width="fill_parent" 
     android:layout_height="0dip"> 

    </FrameLayout> 



    <Button 
     android:id="@+id/buttonClick" 
     android:layout_width="109dp" 
     android:layout_height="105dp" 
     android:layout_gravity="center" 
     android:background="@drawable/obutrador2" > 

    </Button> 

</LinearLayout> 

當我運行應用程序,有一個白色的條紋沿着按鈕佔據了整個屏幕的高度。我如何解決這個問題?這會使該按鈕出現在相機捕捉的圖像上方,因爲該應用具有默認的手機。

問題是如何定位框架佈局,使其填充屏幕並將按鈕居中放置在底部。如果我將FrameLayout全屏顯示,按鈕消失。

我離開一個鏈接發生了什麼照片: https://www.dropbox.com/s/jbns8jddtwxjhdp/IMAG0348.jpg

+0

請上傳一下這個佈局看起來像一個畫面,然後添加一個鏈接到你的問題圖片。 – 2013-02-23 01:32:11

+0

對不起,我忘了,看得更清楚 – wiki 2013-02-23 01:36:35

+0

你可以做一個截圖而不是拍照嗎? – 2013-02-23 01:38:42

回答

1

我想你應該定義的FrameLayout裏面按鈕這樣的。 您可以的FrameLayout父佈局,可以放置在任何你想

<FrameLayout 
     android:id="@+id/preview" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"> 
    <Button 
     android:id="@+id/buttonClick" 
     android:layout_width="109dp" 
     android:layout_height="105dp" 
     android:layout_gravity="center" 
     android:background="@drawable/obutrador2" > 

    </Button> 

</FrameLayout> 

希望這應該是對你的工作按鈕...謝謝

+0

感謝您的回覆,我試着做我說的話,但要麼讓我處於中間位置,要麼讓我處於最左上角......您能想到把它放在一邊並專注於此嗎? – wiki 2013-02-23 01:44:13

+0

我設置重力的底部和中心,但按鈕不見了,但如果我觸摸屏幕底部中心的圖片是 – wiki 2013-02-23 01:54:45