2015-09-18 107 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,它更好,因爲我使用它的相同尺寸的相同設備。 –