2014-11-21 14 views
0

所以我創建了一個ImageView的,把它作爲一個背景,因此現在我試圖把列表視圖上的圖像的頂部,這樣它看起來像:列表視圖上的ImageView的的

http://imgur.com/U11AGI0

我有嘗試使用從一些Stackoverflows解決方案的問題,其中一個使用重量,但它似乎並沒有使它的工作..任何幫助將非常感激。

這是我當前XML

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/ptr_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="horizontal"> 

    <ListView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@android:id/list" 
     android:choiceMode="singleChoice" 
     android:divider="#515E71" 
     android:listSelector="@drawable/list_selector_flatcolor" 
     android:dividerHeight="1.8dp" 
     android:layout_marginLeft="12dp" 
     android:layout_marginRight="11dp" 
     android:layout_marginTop="68dp" /> 


    <TextView 
     android:id="@android:id/empty" 
     android:layout_width="match_parent" 
     android:layout_weight="1" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" /> 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/textView" 
     android:textSize="20px" android:paddingTop="10dip" android:paddingBottom="10dip"/> 

    <ProgressBar 
     style="?android:attr/progressBarStyleLarge" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:id="@+id/progressBar" /> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/imageView" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:scaleType="centerCrop" 
     android:layout_weight="0" 
     android:src="@drawable/background_khabar" /> 


</LinearLayout> 
+2

如果您想將視圖置於海誓山盟之上,請使用RelativeLayout。 ImageView應該是第一個元素,因爲它是背景。 – Carnal 2014-11-21 15:13:21

+0

你想要圖像作爲列表的背景嗎? – 2014-11-21 15:14:00

+0

我想把它們放在彼此的頂部而不是作爲listview背景的圖像。 – qax 2014-11-21 15:15:39

回答

0

我用肉體答案,我不得不使用的RelativeLayout和ListView控件代碼之前放的ImageView的XML代碼!感謝Carnal!

相關問題