We can construct and customize border of buttons using drawables.but i just want to know is there any alternative way to set border to new AppCompatButton using new AppCompat libraries through styles or something ? I have surfed for it and i haven't found any documents.So developers, let me know if any tricks to do that.
And problem is the default behavior of AppCompatButton will change if we were setting android:background property and we may need to provide click states too while the AppCompatButton have the click effect by default.
Related
Is there a way to change the ripple colour of a control programmatically? Specifically, i want to be able to fetch the theme colours from an API and apply them to the whole application. From several answers around, i have learned that android doesn't allow to change the theme dynamically, so I set to implement my own theming.
One thing remains to be changed, the ripple colour:
Is there a way to change this dynamically (programatically) for
a single control?
EDIT: Specifically, I want to apply this to MenuItems inside a NavigationView and children clickable RelativeLayouts views of a ListView.
Is there a reasonable way to do it for the whole application? Like a rough equivalent of changing colorControlHighlight ?
With a MaterialButton you can use:
button.setRippleColor(ContextCompat.getColorStateList(this,R.color.selector));
Is there a way of changing the color of the Spinner control?
For example, Android 6 will render text with an arrow. I need to change the color of that arrow.
The change should apply to any version of android.
For example, Android 4 has underline with corner triangle. I have seen some approaches where you replace the icon that is being drawn, but that solution would not work for me. I need to change the color of the default icon.
Update
I have found how to apply style on Android Spinner using styles.xml,
<item name="android:spinnerStyle">#style/SpinnerItem</item>
but I cannot find what is the correct style to apply for the icon color to change.
It turns out, there is no nice way of doing this. It is possible to change the images used for the spinner, but then I would need to provide different set of images for each version, and also have conditionals / logic on the android code, to specify which set should be used based on version.
Is there a way to replicate the color changing ability provided by QKSMS .
It allows a user to select a color and then changes the app color and everything to that color.This is all done dynamically the moment the user chooses a specific color.
You can try this cool online tool: http://android-holo-colors.com
This enables you to create many themes for app widgets with your preferred color. You can then change your app theme by saving values for your theme in SharesPreferences or something similar and apply them in onCreate of each activity you have in your app. You can also create the themes easily in styles.xml. For each view, it has its own style with its own attributes so you will need to learn how to edit the theme of each view you want by searching...
Hope that helps.
Some Examples:
ActionBar:
https://developer.android.com/training/basics/actionbar/styling.html
Buttons:
https://www.androidcookbook.com/Recipe.seam?recipeId=3307
SeekBar:
Android - styling seek bar
Switch:
How can I style an Android Switch?
And a lot more... You will have to search for what you want.
I am trying to reverse the title shadow on a button in android like the implementation in the ios. I have no idea where I should start. Does anyone have any idea?
I think you can make your own style for button, using Android style Widget.Button as parent. I didn't try it, so I don't know if it private style or not. In your style you can define textShadow attributes. More about styles you can read there
I am new to Android app. development. I need to change the existing style at runtime or can create new styles at runtime and I need to apply it for my buttons and textviews..
Can any one suggest me?
There are several methods to do so (most of them are provided by the super class TextView):
setTextColor to change the color of foreground
setTypeface to change the font style
setBackgroundResource(int) to change its backgrond
setPadding to add padding
All of them work for EditText, Button and others, since most of them extends the TextView class. So, my suggestion is: RTFM... just kidding... read the documentation to see the available functions.
Yesterday I was trying to do something similar.
This links gave me enough info:
Building Custom Components
Custom Android Button Style and Theme
Understanding Android Themes And Styles