Does anyone know how can I change this green color that appears in my editText ?
I would like to do it from the layout XML if it is possible
just below the editText image.
Any help is appreciated.
I could resolve it adding: android:backgroundTint="#color/color_you_wat" to the EditText in the layout file
Programmatically:
editText.getBackground().mutate().setColorFilter(getResources().getColor(R.color.your_color), PorterDuff.Mode.SRC_ATOP);
Using theme:
<style name="AppThem" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- change values below to make same eefect for all EditTexts ->
<item name="colorControlNormal">#c5c5c5</item>
<item name="colorControlActivated">#color/accent</item>
<item name="colorControlHighlight">#color/accent</item>
</style>
<!-- also you can create different styles with values above for many different views ->
Edit:
You can always use in xml file:
"app:backgroundTint="#color/myColor" in xml.
Don't use android:. Otherwise you would lose backward compability with Android 4.4 and older.
Hope it help
Related
I want to change the color of the selected area in the bottom navigation view material 3, but the color does not change in any way. I've tried selector, background, background Tint, and styles. All unsuccessfully.
Currently like this.
It should be like this.
You can change indicator color by overridng it's default style.
Default itemIndicatorStyle :
<style name="Widget.Material3.BottomNavigationView.ActiveIndicator" parent="">
<item name="android:width">#dimen/m3_bottom_nav_item_active_indicator_width</item>
<item name="android:height">#dimen/m3_bottom_nav_item_active_indicator_height</item>
<item name="marginHorizontal">#dimen/m3_bottom_nav_item_active_indicator_margin_horizontal</item>
<item name="shapeAppearance">#style/ShapeAppearance.Material3.NavigationBarView.ActiveIndicator</item>
<item name="android:color">?attr/colorSecondaryContainer</item>
just override the style according to your preference :
<style name="App.Custom.Indicator" parent="Widget.Material3.BottomNavigationView.ActiveIndicator">
<item name="android:color">#color/blue</item>
</style>
And then add this line to your bottomNavigationView xml code :
app:itemActiveIndicatorStyle="#style/App.Custom.Indicator"
you can use this function for change indicator color:
findViewById<BottomNavigationView>(R.id.bottomNavigationView) .itemActiveIndicatorColor = getColorStateList(R.color.white)
and set this annotatin for your onCreate function #RequiresApi(Build.VERSION_CODES.M)
look in the screenshot
I have created some custom styles for CalendarView to change the text colors:
<style name="CalenderViewCustom" parent="Theme.AppCompat">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorAccent">#color/colorAccentYellow</item>
<item name="android:textColorPrimary">#color/colorPrimaryDarker</item>
</style>
And applied them into the calendar like so:
<CalendarView
...
android:theme="#style/CalenderViewCustom"
android:dateTextAppearance="#style/CalenderViewDateCustomText"
android:weekDayTextAppearance="#style/CalenderViewWeekCustomText"
...
/>
I would like to change the text color of '9', to a different one from the background of '16'.
Currently, both of them are determined by the colorAccent attribute.
Is there any other attribute that would change only one of them separately?
Found a pretty cool solution:
We can use the CompactCalendarView package which is a little old but still works perfectly fine (Android 26+)
For example to set the "today" color to black:
<com.github.sundeepk.compactcalendarview.CompactCalendarView
android:layout_width="match_parent"
android:layout_height="280dp"
...
app:compactCalendarCurrentDayTextColor="#android:color/black"
...
/>
Given the following style in file: res/values/styles.xml
<style name="GiftCardFragment.TitleLLLabelTV">
<item name="android:paddingStart">5dp</item>
<item name="android:paddingLeft">5dp</item>
</style>
android:paddingStart is only valid in Android platform 17 and above, so then I would create a new styles.xml file in "res/values-v17/styles.xml".
But the question is: Do I have to repeat the whole style, or could I just add the styles I want to add extra (alternatively override) for a given platform and above in "res/values-v17/styles.xml"? Like:
<style name="GiftCardFragment.TitleLLLabelTV">
<item name="android:paddingStart">5dp</item>
</style>
And then Android would merge then at runtime. Am I correct? Any pointing in right direction appreciated, I couldnt find documentation really covering this case.
I've recently been looking into customizing the divider colour between items in a Spinner's drop down list, and I found the way to do it for all spinners at once via the application theme. For example:
<style name="custom_divider">
<item name="android:divider">#FFFFFF</item>
<item name="android:dividerHeight">5dp</item>
</style>
<style name="holo_light_dark_action_bar_custom_dropdown" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:dropDownListViewStyle">#style/custom_divider</item>
</style>
What I want to do is style the dividers for one specific spinner (in this case, the spinner in the action bar), rather than all spinners. I haven't seen any solutions for that, so I'm hoping it's something obvious and that I just missed it. :)
Is it possible to change textColor in ListView without defining custom adapter for it? As in TextView we can apply style = "#style/mystyle" in which we can define textcolor.
<ListView
android:id="#+id/listview"
style="#style/WhiteText"
/>
In values, the style is defined as:
<resources>
<style name= "WhiteText">
<item name ="android:textColor">#FFFFFF </item>
<item name="android:background">#000000 </item>
</resources>
I tried it but it's not giving me desired output. So I want to ask, is it a valid way or not?
might be possible with to define the style for the ListView and set the Text color for that.
See below SO Answer:
First
Second
Hope it will help you.
If any query then let me know.