Android- How to set brightness to textView?

1.4k views Asked by At

I am working on a night light app. I want to apply brightness to a textView. I know how to set screen brightness but i am unable to figure how to set it on a textView.

2

There are 2 answers

0
Pankaj Sakariya On

A few things to try:

Try to use text shadow it will help you.

  1. Look on a real device, not in Eclipse "Graphical layout" which does not support text shadow.
  2. Decrease the shadow radius to 1. The larger the radius, the more blurred the shadow is.
  3. Check if the style file you wrote in in the main "values" directory or under values-?dpi. Maybe your device dpi does not target your style file

And agreed with androicode.

Thanks.

0
blueware On

You can use the alpha property for TextView in XML:

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="TextView"
        android:alpha="0.75"/>

Where Alpha values are between 0 and 1 (0: is totally faded and 1: normal) Here, the 0.75 alpha value will give 25% fading percentage to the TextView