ces*_*ira 14 android overlay imageview
所以我有一个来自网络的图像列表,我不知道它们是哪种颜色,我想在ImageView上放置一个文本.
我的想法是将ImageView,一个带有透明度渐变的图像叠加放在ImageView及其上方的文本上.我想模仿这种行为:

无论如何通过XML来做到这一点?
adi*_*nes 20
当您为列表项编写XML时getView(...),无论ListAdapter您编写什么内容都会夸大其中,您肯定可以这样做.
对于列表项,这样的事情:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="320dp"
android:layout_height="240dp"
android:background="#ACACAC"/>
<RelativeLayout
android:layout_width="320dp"
android:layout_height="240dp"
android:background="@drawable/gradient">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Here is your text"
android:textColor="#000000"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
然后创建可绘制/渐变.为此你可以从这里回收答案.
| 归档时间: |
|
| 查看次数: |
22786 次 |
| 最近记录: |