android.widget.TextView is a class in the Android SDK that is used to display text in a user interface. The setAlpha() method is used to set the opacity of the text view. It takes a float value between 0 and 1, where 0 is completely transparent and 1 is completely opaque.
Example 1:
TextView textView = findViewById(R.id.textView); // set alpha to 0.5 textView.setAlpha(0.5f);
In this example, we get a reference to a TextView object using the findViewById() method, and then set its alpha to 0.5 using setAlpha().
TextView textView = findViewById(R.id.textView); // set alpha to 0.2 textView.setAlpha(0.2f);
This example shows how to set the alpha of a TextView that is defined in an XML layout file. We get a reference to the TextView using findViewById(), and then set its alpha to 0.2 using setAlpha().
The android.widget.TextView class is included in the Android package library.
Java TextView.setAlpha - 23 examples found. These are the top rated real world Java examples of android.widget.TextView.setAlpha extracted from open source projects. You can rate examples to help us improve the quality of examples.