2015-09-18 109 views
0

我有一些Button和ImageView的问题。 我在布局XML类似的东西:(EQ LG G2)Android按钮在图像下

<Button 
     android:id="@+id/startGame" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/pressit" 
     android:textSize="30dp" 
     android:paddingBottom="16dp" 
     android:background="@drawable/button_running_gradient" 
     android:gravity="bottom|center" 
     android:layout_alignTop="@+id/relativeLayout" /> 

    <ImageView 
     android:id="@+id/img_How_To_Play" 
     android:src="@drawable/how_to_img" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentTop="true" 
     android:layout_centerHorizontal="true" 
     android:scaleType="fitXY" 
     android:adjustViewBounds="true" /> 

    <RelativeLayout 
     android:id="@+id/relativeLayout" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
     android:layout_height="match_parent" tools:context=".MainGame"> 

     ... 

在一个电话(EQ索尼XPERIA J),当应用程序启动按钮下的图像和RelativeLayout的,它的确定,但在另一个高于图像和布局。 我想要所有手机的第一个选项。我怎么能做到这一点?

+3

显示完整的布局 –

+3

'机器人:layout_alignTop =“@ + ID/RelativeLayout的”'删除'+' –

回答

0
<RelativeLayout 
    android:id="@+id/relativeLayout" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
    android:layout_height="match_parent" tools:context=".MainGame"> 
    <Button 
     android:id="@+id/startGame" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="dfjvb" 
     android:textSize="30dp" 
     android:paddingBottom="16dp" 
     android:gravity="bottom|center" 
     android:layout_Above="@+id/img_How_To_Play" /> 

    <ImageView 
     android:id="@+id/img_How_To_Play" 
     android:src="@drawable/photo243" 
     android:layout_below="@+id/startGame" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 

     android:layout_centerHorizontal="true" 
     android:scaleType="fitXY" 
     android:adjustViewBounds="true" /> 

</RelativeLayout> 
+0

你不应该只邮编,请对OP解释究竟为什么你的代码是正确的? – Opiatefuchs

+0

请参阅http://www.chatup.net78.net/sam.png上的OP,它更好,因为我使用它的相同尺寸的相同设备。 –