Force fading edge on TextView
Asked Answered
C

1

1

I have TextView inside FrameLayout and I want to draw fading edge of FrameLayout over TextView to indicate that text may be expanded vertically. How to draw fading enge of FrameLayout?

Fragment of layout:

<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>
Camisado answered 10/5, 2011 at 9:8 Comment(1)
Solution: just specify fadingEdge and fadingEdgeLength for TextView.Camisado
C
3

Add fadingEdge and fadingEdgeLength attributes to your TextView definition

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

HINT: Try to avoid using frame layouts where necessary, usually they are not required.

Chak answered 10/9, 2011 at 20:12 Comment(2)
This is not working, I just kept an Relative_Parent_Layout and TextView with maximum 3 lines. Any suggestion !!Wet
@Shubh please note that this answer was posted in 2011 and would have been accurate for gingerbread, Android has changed much in the last years and I no longer actively develop for the framework. Please consult google documentation (always the best advice) for the latest information.Chak

© 2022 - 2024 — McMap. All rights reserved.