Priya
Priya

Reputation: 1632

EditText Background color opacity android

I am giving user to change background color of edit textview. I want also give user to chance for set opacity of color. My edit text XML code is like below

<EditText
    android:id="@+id/text_quotes"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/transparent"
    android:gravity="center"
    android:textStyle="bold"
    android:textColor="?attr/colorPrimaryDark"
    android:shadowRadius="0"
    android:text="Text" 
    android:textCursorDrawable="@null"
    android:textSize="@dimen/newMainText" />

Let me know if someone have idea to set opacity of change background color of this view. Thanks a lot !

Upvotes: 0

Views: 1295

Answers (1)

Sunil P
Sunil P

Reputation: 3838

You can try using this alpha, it gives you the opacity, programmatically

youredittext.getBackground().setAlpha(45);

Upvotes: 2

Related Questions