请告诉我如何按照图像添加透明背景的textview覆盖imageview。详细说明是,我想在imageview上添加两个textview,一个textview是标题,另一个是描述,而且背景是透明的。请帮忙。
![enter image description here](https://istack.dev59.com/AJ0QD.webp)
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="center"
android:src="@drawable/golden_gate" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_gravity="center_horizontal|bottom"
android:padding="12dip"
android:background="#AA000000"
android:textColor="#ffffffff"
android:text="Golden Gate" />
</FrameLayout>
你可以将图片设置为你的布局父项(如RelativeLayout)的背景,然后在第一个布局底部放置另一个背景透明的布局。 接着,我们将你的textView放入第二个布局中。