【问题标题】:Force fading edge on TextView在 TextView 上强制淡出边缘
【发布时间】:2011-09-11 04:12:33
【问题描述】:

我在 FrameLayout 中有 TextView,我想在 TextView 上绘制 FrameLayout 的渐变边缘,以指示文本可以垂直扩展。 FrameLayout的渐变效果如何绘制?

布局片段:

<FrameLayout
    android:layout_width="fill_parent" 
    android:layout_height="@dimen/list_item_collapsed"
>
    <TextView
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
    />
</FrameLayout>

【问题讨论】:

  • 解决方案:只需要为TextView指定fadingEdge和fadingEdgeLength即可。

标签: android


【解决方案1】:

在 TextView 定义中添加 fadingEdge 和 fadingEdgeLength 属性

<TextView
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:fadingEdge="vertical"
    android:fadingEdgeLength="@dimen/fadelength"
/>

提示:尽量避免在必要时使用框架布局,通常它们不是必需的。

【讨论】:

  • 这不起作用,我只保留了一个 Relative_Parent_Layout 和 TextView,最多 3 行。任何建议!
  • @Shubh 请注意,这个答案是在 2011 年发布的,对于姜饼来说应该是准确的,Android 在过去几年发生了很大变化,我不再积极地为该框架进行开发。请查阅谷歌文档(始终是最好的建议)以获取最新信息。
猜你喜欢
  • 1970-01-01
  • 2012-05-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-07-30
  • 1970-01-01
  • 2016-05-02
  • 1970-01-01
相关资源
最近更新 更多