2013-12-21 68 views
0

我有一个框架布局。框架布局的高度是400px。我在布局的底部有一个按钮。现在我想要在框架布局顶部的第二个按钮。这是一个按钮。Android - FrameLayout有两行 - 顶部和底部?

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


    <ImageButton 
     android:id="@+id/smileButton" 
     android:background="@drawable/smile_button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|right" 
     android:adjustViewBounds="true" 
     android:scaleType="centerInside" /> 

      </FrameLayout> 

而这是与两个按钮。它不工作。我没有看到顶部的第二个按钮。

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


    <ImageButton 
     android:id="@+id/smileButton" 
     android:background="@drawable/smile_button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="top|right" 
     android:adjustViewBounds="true" 
     android:scaleType="centerInside" /> 

    <ImageButton 
     android:id="@+id/smileButton" 
     android:background="@drawable/smile_button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|right" 
     android:adjustViewBounds="true" 
     android:scaleType="centerInside" /> 

      </FrameLayout> 

回答

1
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/framelayout1" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" > 

    <ImageButton 
     android:id="@+id/smileButton" 
     android:background="@drawable/smile_button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="top|right" 
     android:adjustViewBounds="true" 
     android:scaleType="centerInside" /> 

    <ImageButton 
     android:id="@+id/smileButton" 
     android:background="@drawable/smile_button" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|right" 
     android:adjustViewBounds="true" 
     android:scaleType="centerInside" /> 

      </FrameLayout> 

试试这个