2016-11-17 84 views
0

我無法弄清楚爲什麼我的應用程序的頁腳顯示在手機上,而不是在平板電腦上顯示。在Android平板電腦上未顯示頁腳

這裏是頁腳佈局:

<RelativeLayout 
    android:id="@+id/footer" 
    android:layout_width="match_parent" 
    android:layout_height="45dp" 
    android:layout_alignParentBottom="true"> 
    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentBottom="true" 
     android:scaleType="fitXY" 
     android:src="@drawable/ic_devicescreenlogo" 
     /> 
    <TextView 
     android:id="@+id/version" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentStart="true" 
     android:layout_alignParentBottom="true" 
     android:paddingBottom="2dp" 
     android:paddingStart="2dp" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:textColor="@color/light_grey"/> 
</RelativeLayout> 

在手機(4.6 「),它看起來像這樣: Phone

而且對平板電腦(7」)圖像不顯示的唯一版本: enter image description here

你知道什麼是錯的嗎?

謝謝

[編輯]

下面是圖片,我使用:waves

回答

1

那麼這代碼應該相當多的工作,我已經嘗試過了我的仿真器和它工作得很好用7英寸的屏幕,試圖讓實際的設備,看看是否能解決問題

<RelativeLayout 
    android:id="@+id/footer" 
    android:layout_width="match_parent" 
    android:layout_height="45dp" 
    android:layout_alignParentBottom="true"> 
    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentBottom="true" 
     android:scaleType="fitXY" 
     android:src="@drawable/arsenal" 
     /> 
    <TextView 
     android:id="@+id/version" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentStart="true" 
     android:layout_alignParentBottom="true" 
     android:paddingBottom="2dp" 
     android:paddingStart="2dp" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:textColor="@color/darkgray"/> 
</RelativeLayout> 
+0

而我只是asumming你把你的代碼的RelativeLayout –

+0

內部佈局預覽它顯示預期太多,但在平板電腦設備的Nexus 7的圖像不顯示。圖像本身有問題嗎?它需要一些更大的格式或什麼? –

+0

好吧,你可能是對的,請分享你使用的圖像,或者更好的嘗試使用atlist三個不同的圖像,看看它是如何轉出來的... –

0
Use this code.. its work fine. 
<RelativeLayout android:id="@+id/footer" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_alignParentBottom="true" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 

    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true"> 
    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_alignParentBottom="true" 
     android:scaleType="fitXY" 
     android:src="@mipmap/ic_launcher" 
     /> 
    <TextView 
     android:id="@+id/version" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentStart="true" 
     android:layout_alignParentBottom="true" 
     android:paddingBottom="2dp" 
     android:paddingStart="2dp" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:textColor="@color/colorPrimary" 
     android:paddingLeft="2dp" 
     android:layout_alignParentLeft="true" /> 
    </LinearLayout> 
</RelativeLayout 

> Blockquote 
+0

這將是很好,如果你解釋爲什麼作者得到它的錯誤,以及你的答案如何糾正它 – Garf365

+0

這沒有幫助,它會將版本放置在圖像下方。我想要結束。 –

0

添加父親相對佈局重力底部。

android:layout_gravity="bottom" 

<RelativeLayout 
android:id="@+id/footer" 
android:layout_width="match_parent" 
android:layout_height="45dp" 
android:layout_alignParentBottom="true"> 
+0

這沒有幫助。 –