2011-12-08 28 views
0

我想創建一個具有固定列大小(可以說80dp)的GridView佈局。作爲子元素(單元格),我希望有2個ImageView: 1.填充整個單元格的一個ImageView - 它是一個縮略圖圖像。 2.第二ImageView填充到右下角,是一個12x12的小圖標,應覆蓋第一個ImageView。安卓GridView佈局與2 ImageView作爲子視圖

如何實現這一目標? 謝謝

回答

1

試試這個佈局。請注意,下面的代碼可能會有拼寫錯誤,或者可能使用可能在您的項目中不存在的drawable。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/image_and_text_layout" android:paddingBottom="5dip" android:paddingTop="5dip" android:layout_height="80dip" android:layout_width="80dip"> 

     <ImageView android:id="@+id/option_image" android:src="@drawable/background_night_blue_gradient" android:scaleType="fitXY" android:layout_height="fill_parent" android:layout_width="fill_parent"/> 

     <ImageView android:id="@+id/option1_image" android:src="@drawable/icon" android:scaleType="fitXY" android:layout_height="12dip" android:layout_width="12dip" android:layout_alignParentRight="true" android:layout_alignParentBottom="true"/> 



</RelativeLayout>