Android系统.在图像上添加文本效果

Android系统.在图像上添加文本效果,第1张

概述世界!我是一名学生,我正在开发一个关于我的国家的Android应用程序.我注意到应用程序中的漂亮布局.在这张图片中,textviews放置在具有美丽背景的图像底部(种类的渐变)我想知道你是否可以帮助我弄清楚如何做或显示方向.我现在所拥有的一切:row.xml<?xmlversion="1.0"encoding="ut

世界!我是一名学生,我正在开发一个关于我的国家的Android应用程序.我注意到应用程序中的漂亮布局.


在这张图片中,textvIEws放置在具有美丽背景的图像底部(种类的渐变)
我想知道你是否可以帮助我弄清楚如何做或显示方向.
我现在所拥有的一切:
row.xml

<?xml version="1.0" enCoding="utf-8"?><relativeLayout    androID:layout_wIDth="match_parent"    androID:layout_height="200dp"    androID:layout_marginBottom="5dp"    xmlns:androID="http://schemas.androID.com/apk/res/androID">        <ImageVIEw            androID:layout_wIDth="match_parent"            androID:layout_height="match_parent"            androID:src="@drawable/medeobase"            androID:scaleType="fitXY"            androID:ID="@+ID/place_image"            />        <relativeLayout            androID:layout_wIDth="match_parent"            androID:layout_height="50dp"            androID:layout_alignParentBottom="true"            androID:background="#AA000000">            <TextVIEw                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:text="Medeu"                androID:ID="@+ID/place_ID"                androID:layout_marginleft="20dp"                androID:layout_margintop="2dp"                androID:textSize="18sp"                androID:textcolor="@color/colorWhite"/>            <TextVIEw                androID:layout_wIDth="wrap_content"                androID:layout_height="wrap_content"                androID:text="Almaty region"                androID:textcolor="@color/colorPrimary"                androID:layout_marginleft="20dp"                androID:layout_below="@+ID/place_ID"                androID:textSize="12sp"                androID:ID="@+ID/place_ID_sub"                />        </relativeLayout>    </relativeLayout>

谢谢!

解决方法:

您可以做的是,实际上使用GradIEntDrawable作为包含TextVIEws的relativeLayout的背景.

渐变可能如下所示:

my_custom_drawable.xml:

<?xml version="1.0" enCoding="utf-8"?><shape xmlns:androID="http://schemas.androID.com/apk/res/androID">    <gradIEnt        androID:angle="90"        androID:endcolor="@androID:color/transparent"        androID:startcolor="@androID:color/black" /></shape>

然后用渐变替换relativeLayout的backgroundcolor,如下所示:

<relativeLayout    androID:layout_wIDth="match_parent"    androID:layout_height="50dp"    androID:layout_alignParentBottom="true"    androID:background="@drawable/my_custom_gradIEnt.xml">

这将导致:

您需要在GradIEntDrawable中使用颜色,以满足您的需求.我无法告诉你哪种颜色适合你的需要.

您还可以添加centercolor – 有关更多属性,请参阅documentation.

我可能会将字幕textcolor更改为与标题textcolor相同的颜色.

总结

以上是内存溢出为你收集整理的Android系统.在图像上添加文本效果全部内容,希望文章能够帮你解决Android系统.在图像上添加文本效果所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1108311.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-29
下一篇2022-05-29

发表评论

登录后才能评论

评论列表(0条)

    保存