Suren
Suren

Reputation: 11

Nativescript - Button Pressed highlighter css not working

What I need: An active css effect for the button click (background-color of the button should change on clicking and holding it)

I have tried the following link: [https://docs.nativescript.org/ApiReference/ui/styling/HOW-TO.html]

page.css = "button:pressed { color: red; }";

Also tried applying the above style through stylesheet(.css)

I get no response in the UI(view) as given in the documentation.

Thanks in advance.

Upvotes: 1

Views: 3150

Answers (2)

Neli Chakarova
Neli Chakarova

Reputation: 660

The section of the article that you are referring to is in the process of revision and it is not correct. We apologize for the misunderstanding!

States are currently not supported, so it will not be possible to change the color of the button while it is pressed. There is an open issue in the NativeScript repository in GitHub, where you can contribute and follow the discussion about state selectors.

However, you can change the color of the button after it has been pressed by using the tapEvent.

Upvotes: 1

user5471213
user5471213

Reputation:

Try this

 button:active{
background:olive;
 }

and

 button:focus{
background:olive;
 }

Upvotes: 0

Related Questions