如何创建布局,如我附加的(Android ICS 联系人收藏布局)图像
我正在使用网格视图来创建照片网格的布局。那是完美的工作。但
如何创建覆盖布局,如带有名称或图像的黑色透明?任何人指导我这样做
提前致谢
如何创建布局,如我附加的(Android ICS 联系人收藏布局)图像
我正在使用网格视图来创建照片网格的布局。那是完美的工作。但
如何创建覆盖布局,如带有名称或图像的黑色透明?任何人指导我这样做
提前致谢
试试这个:(注意:这是GridView
将在 中设置的自定义 XML 布局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"
属性让它看起来像你喜欢的那样。其中的50是设置透明度的alpha。