2012-11-01 30 views
0

我是Android開發的noob,我試圖在9舊Androids庫的FlakeView上放置按鈕。當我使用框架佈局將按鈕放置在包含FlakeView的佈局上方時。但是,當我運行應用程序時,按鈕顯示在碎片的後面,而不是在它們的前面。我之前使用Frame Layout來完成這個沒有任何問題,所以我不明白它現在不工作。任何幫助是極大的讚賞。如何在佈局中的FlakeView上放置按鈕?

佈局

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 
    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="More" 
     android:id="@+id/more"/> 
    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Less" 
     android:id="@+id/less"/> 
    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="New Game" 
     android:id="@+id/newgame"/> 

</LinearLayout> 

<LinearLayout 
    android:id="@+id/container" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:gravity="center" 
    android:orientation="vertical"> 

    </LinearLayout> 

</FrameLayout> 

回答

1

你有你的佈局向後爲您所要完成的任務安排。請執行以下操作:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 

<LinearLayout 
android:id="@+id/container" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:gravity="center" 
android:orientation="vertical"> 

</LinearLayout> 
<LinearLayout 
android:orientation="horizontal" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content"> 
<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="More" 
    android:id="@+id/more"/> 
<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Less" 
    android:id="@+id/less"/> 
<Button 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="New Game" 
    android:id="@+id/newgame"/> 

</LinearLayout> 



</FrameLayout> 
相關問題