2013-08-20 39 views
0

如何在圖像上方添加圖像?這是我的屏幕截圖http://imgur.com/Yh4DqnJ其中只有1圖像的背景現在我想添加兩個像這樣的圖像按鈕http://imgur.com/XrLXb0L下面是我的代碼,只有背景圖像 下面是我的代碼有背景imeage onheader Linearlayout我如何添加兩個圖像左側和右側?如何將兩個圖像相互重疊

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#ffffff" 
    android:orientation="vertical" > 


     <LinearLayout 

    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/imagelogo2" 

    android:orientation="horizontal" > 




     </LinearLayout> 



     <LinearLayout 
     android:id="@+id/lytContent" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_above="@+id/txtCopyright" 
     android:layout_marginTop="10dp" 
     android:background="@drawable/border2" 
     android:layout_below="@+id/lytTitlebar" 
     android:orientation="vertical" > 



     <ListView 
      android:id="@+id/listMainMenu" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 

      android:listSelector="@drawable/listview_selector" 
      android:dividerHeight="1dip" 
      android:fadeScrollbars="true" /> 
    </LinearLayout> 



    </LinearLayout> 
+0

你應該使用框架佈局。它會將元素重疊在一起。 –

+0

怎麼樣?例如你知道? – user2686011

+0

自己尋找基於framelayout的示例。 –

回答

0

對於重疊的圖像,你或許應該使用的FrameLayout, 有關框架佈局的詳細信息請參見使用重疊的圖像,此link

1

最好的辦法是通過框架佈局 試試這個代碼

<FrameLayout 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
    <ImageView 
     android:src="@drawable/onlymobilepro" 
     android:scaleType="fitCenter" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent"/> 
    <TextView 
     android:text="This is Frame Layout!!!" 
     android:textSize="24px" 
     android:textColor="#cc0000" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent" 
     android:gravity="top"/> 
    <TextView 
     android:text="Learn Android Development At onlyMobilePro.com" 
     android:textSize="24px" 
     android:textColor="#00dd00" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent" 
     android:gravity="center"/> 
</FrameLayout>