Android 安卓在图像上添加文本,效果良好
世界!我是一名学生,正在开发一个关于我的国家的Android应用程序。我注意到一个应用程序中有一个漂亮的布局。 在这张图片中,文本视图位于背景优美的图片底部(有点渐变) 我想知道你是否能帮我弄清楚怎么做或者给我指明方向。 目前我所拥有的一切是: row.xmlAndroid 安卓在图像上添加文本,效果良好,android,Android,世界!我是一名学生,正在开发一个关于我的国家的Android应用程序。我注意到一个应用程序中有一个漂亮的布局。 在这张图片中,文本视图位于背景优美的图片底部(有点渐变) 我想知道你是否能帮我弄清楚怎么做或者给我指明方向。 目前我所拥有的一切是: row.xml 谢谢 实际上,您可以使用GradientDrawable作为RelativeLayout的背景,以保存您的TextViews 渐变可以如下所示: <RelativeLayout android:layout_width
谢谢 实际上,您可以使用
GradientDrawable
作为RelativeLayout
的背景,以保存您的TextView
s
渐变可以如下所示:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@drawable/my_custom_gradient.xml">
my\u custom\u 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>
这将导致:
当然,您需要在GradientDrawable
中使用各种颜色,使其适合您的需要。我不能告诉你什么颜色适合你的需要
您还可以添加中心色
-有关更多属性,请参阅
我可能会将字幕textcolor更改为与标题textcolor相同的颜色。非常感谢:)这对我很有帮助!很抱歉,我不能投票给你的答案,因为我的评分不够。@Zhadyrassyndaniya没问题:-)我认为你仍然可以接受这个答案,尽管没有任何声誉:-)很有帮助。谢谢
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@drawable/my_custom_gradient.xml">