覆盖在机器人的白色背景图象的白色文本

时间:2016-08-26 15:38:30

标签: android

我正在使用android studio进行构建,我有一个带白色文本的白色背景图像,白色文本覆盖在白色背景图像上。这就是我的代码看起来的样子

library(dplyr)
library(lubridate)

dt = read.table(text = "vhc_key     start_date  end_date
                1           2006-12-16  2015-10-05
                1           2015-11-21  NA
                2           2014-01-14  2014-02-14
                2           2014-03-14  NA
                3           2014-01-14  2014-02-14
                3           2015-03-14  NA", header=T, stringsAsFactors=F)


dt %>% 
  mutate(start_date = ymd(start_date),                                                  # update columns to date-time (if they are not)
         end_date = ymd(end_date)) %>%
  group_by(vhc_key) %>%
  mutate(dist = as.numeric(difftime(max(start_date), end_date, units="weeks"))) %>%     # get distance of end date and max start date (in weeks)
  filter(!is.na(dist) & dist <= 24) %>%                                                 # keep rows with distance up to 24 weeks (6 months)
  ungroup %>%
  select(-dist)

# # A tibble: 2 x 3
#   vhc_key start_date   end_date
#     <int>     <date>     <date>
# 1       1 2006-12-16 2015-10-05
# 2       2 2014-01-14 2014-02-14

有没有办法让白色文字显示在白色背景上。我很高兴知道。

1 个答案:

答案 0 :(得分:3)

为文本添加阴影,例如

    <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:layout_marginTop="200dp"
            android:layout_marginLeft="20dp"
            android:textSize="20sp"
            android:textStyle="normal"
            android:text="WHITE TEXT"
            android:textColor="@color/white"
            android:fontFamily="sans-serif-condensed"
            android:ellipsize="end"
            android:shadowColor="#55000000"
            android:shadowDx="6"
            android:shadowDy="6"
            android:shadowRadius="6"
            />

您也可以将图像用作TextView背景,并根据您的情况消除ImageView和潜在的RelativeLayout。