Android - How to change the color of all button when it being clicked -
What would I want to know, if there is any way to change click color on the whole activity.
The next most active activity -
& lt; Activity Android: name = "com.example.test.MainActivity" Android: Theme = "@ Style / Theme" is set. AppCompat.Light.DarkActionBar "android: label =" @ string / app_name "> & lt; intent-filter & gt; & lt; action android: name =" android.intent.action.MAIN "& gt; & lt ; / Action & gt; & lt; Category android: name = "android.intent.category.NORMAL" & gt; & gt; / category & gt; & lt; / int-filter & gt; & lt; / activity & As you can see, I am using the next topic for the activity -
android: theme = "@ style / Theme.Base.AppCompat.Light. DarkActionbar " It makes any click color to be blue - when a button or something is being pressed, when it is clicked, turn it blue
Now what I would like to know is there is a way to change the blue color to a different color, and now by changing the background for each visible item I am using. >
Thanks for any help
File name: /res/drawable/button_color.xml
& lt;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Selector xmlns: Android = "http://schemas.android.com/apk/res/android" & gt; Item Android: state_enabled = "false" android: drawable = "@ color / color1" / & Lt; item Android: state_focused = "true" android: drawable = "@ color / color1" /> item Android: state_pressed = "true" android: drawable = "@ color / color1" / & Gt; & lt; Items Android: Drauble = "@ Colors / Colors 1" />
Take this button in your button style like this:
Like the example given below, the new style in your Resource Value folder Create and change your application feature android: theme = "@ style / customActionBarTheme" item name =" Android: button style "& gt; @ style / srp_button & lt; / item & gt; ; / Style & gt; & lt; Style name = "srp_button" parent = "@ android: style / widget.button" gt; & lt; itemname = "android: background" & gt; @drawable / button_color & lt; / Item & gt; & lt;! - Text color issued here - & gt; & lt; / style & gt;
Comments
Post a Comment