1
如何創建佈局,如(安卓ICS聯繫人收藏佈局)佈局Android這樣的接觸圖像I連接如何創建最喜愛的
現在用的網格視圖中爲照片創建佈局格。這是完美的工作。但是
我該如何創建像名稱或圖像的黑色透明覆蓋佈局?任何一個指導我提前做
感謝
如何創建佈局,如(安卓ICS聯繫人收藏佈局)佈局Android這樣的接觸圖像I連接如何創建最喜愛的
現在用的網格視圖中爲照片創建佈局格。這是完美的工作。但是
我該如何創建像名稱或圖像的黑色透明覆蓋佈局?任何一個指導我提前做
感謝
試試這個:(注:這是自定義XML佈局爲GridView
,這將是在Adapter
設置)
<FrameLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:gravity="center" >
<ImageView
android:id="@+id/imgProfilePicture"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/ic_contact_picture" >
</ImageView>
<TextView
android:id="@+id/txtUserName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:background="#50000000"
android:gravity="center"
android:text="User Name"
android:textColor="#ffffff"
android:textSize="11sp" >
</TextView>
</FrameLayout>
它看起來這樣的:
這是原樣是從我的一個應用程序。玩弄android:layout_width
和android:layout_height
來設置你自己的尺寸。此外,小提琴這個android:background="#50000000"
屬性讓它看起來像你喜歡。其中的是設置透明度的alpha。
嘗試'FrameLayout'。它把內容放在一起。 – abbath 2013-03-13 10:25:36
...你可以看看android源碼... – Selvin 2013-03-13 10:26:59
https://github.com/android/platform_packages_apps_contacts/tree/master/res/layout – RobinHood 2013-03-13 10:28:12