0

最近我看到一个应用程序,它有一个带有文本的图像。

应用程序是否使用ImageViewTextView?文字如何覆盖图像?它是如何完成的?

我附上了截图。

在此处输入图像描述

4

3 回答 3

2

在布局中的 TextView 上设置属性 android:background="#00000000"。XML 文件。

<FrameLayout 
android:layout_height="wrap_content"
android:layout_width="match_parent"
>

<ImageView
android:src="@drawable/your_image"
android:layout_height="match_parent"
android:layout_width="match_parent"

/>

<TextView
android:height="match_parent"
android:width="match_parent"
android:background="#00000000" 
android:gravity="bottom"
/>

</FrameLayout>
于 2013-01-10T06:13:16.993 回答
1

您可以使用 FrameLayout 将 TextView 放在 ImageView 上,也可以使用带有背景资源的文本视图作为图像,例如:

 <TextView
                            android:layout_gravity="center"
                            android:background="@drawable/custom_buttonclick"
                            android:gravity="center"
                            android:textSize="12dp"
                            android:textStyle="bold" />
于 2013-01-10T06:37:18.573 回答
0

通过使用相对布局、ImageView 和 TextView,您可以实现将 textView 的背景颜色透明化。

于 2013-01-10T06:14:40.143 回答