I am using an action drawer with a menu. The icons appear in black as in the following screenshot:
I am trying to change the color of these icons, pretty much the same as in the design guidelines:
However, I cannot find where to do that or which style attribute will allow me to do so.
If you're using a CircledImageView you can set the tint of the icon directly on the view using setImageTint(int tint).
If you're using a traditional ImageView you need to create a Drawable from your icon resource and apply the tint to it, and then set it to the view:
Drawable iconDrawable = mContext.getResources().getDrawable(R.drawable.icon, mContext.getTheme());
iconDrawable.setTint(mContext.getColor(R.color.bg_color, mContext.getTheme()));
iconView.setImageDrawable(iconDrawable);
EDIT: To access icons in a menu you can do something like this when it's created:
for(int i = 0; i < menu.size(); i++) {
Drawable iconDrawable = menu.getItem(i).getIcon();
iconDrawable.setTint(mContext.getColor(R.color.bg_color, mContext.getTheme()));
}
They changed the layout for the Action Drawer items without giving an option to change the color/disable it.
v23/action_drawer_item_view.xml
<ImageView
android:id="#+id/wearable_support_action_drawer_item_icon"
android:layout_width="#dimen/action_drawer_item_icon_size"
android:layout_height="#dimen/action_drawer_item_icon_size"
android:layout_gravity="center_vertical"
android:background="#drawable/action_item_icon_background"
**android:tint="?android:attr/colorBackground"**
android:padding="#dimen/action_drawer_item_icon_padding"
android:scaleType="fitCenter"
tools:ignore="ContentDescription" />
Since there's no access to the adapter, it's not possible change the color.
Related
I noticed that many apps uses a custom global tint color like Pages (Yellow) or Music (Red). NSAlert default buttons respect this tint, as NSOpenPanel and others do (for example drop-down arrow as show in picture).
I alos noticed that NSAlert brings a delete button that shows text in red. Do you know how to get it to appear?
Thanks
How could I specify a specific global color. I create UI using code and not Storyboard.
Searching in Apple's app folders, such as Pages, I found what we need to do to change the app's overall tint.
Create a color object in the Asset;
In the info.plist add the key NSAccentColorName that is a string assigned to the color name created at step 1;
This colors NSAlert default buttons and all control's accent elements.
I am developing a cross-platform application using native-script angular.
In Android, I face the issue in the selected indicator colour in the segmented bar. Anyone Knows how to change the selected indicator colour in the segmented bar. It shows the default color blue.
<SegmentedBar #tabs [items]="myItems" selectedIndex="0" (selectedIndexChange)="onSelectedIndexChange(tabs.selectedIndex)" class="m-5" selectedBackgroundColor="gray" ></SegmentedBar>
In the Segemented bar add the property selectedBackgroundColor="gray"
I have a forms application that has a dark mode. However the Apple information that appears at the top of the display and also the slider bar at the bottom appear to very bright. Is there a way to change the color of these?
The top bar can only be black or white, or if you don't want to see it at all, you can hide it.
The bottom (tab) bar, can be influenced, you can use the Appearance APIs on iOS. For example, in your AppDelegate.cs file add a line like this: UITabBar.Appearance.TintColor = Color.Red.ToUIColor();
There are more advanced scenarios possible, have a look at my blog post about it here: https://blog.verslu.is/xamarin/xamarin-forms-xamarin/spicing-up-your-xamarin-formsios-tabbar/
And the (open) PR on the Xamarin.Forms repo here, which will makes this possible from the Forms framework directly: https://github.com/xamarin/Xamarin.Forms/pull/4899
In app delegates.cs find Finishlaunching method and all following code. Also set the color accordingly.
UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(190, 18, 40);
UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor =
UIColor.Blue});
I'm using a Side Menu iOS (not my choice just by the way) and I stumbled upon an issue that can be seen in the following image:
If you look close enough in the above figure, the red rectangle is actually highlighting the text 'Menu' that used to open the side menu and it's barely visible. It's quite simply changing the navigation bar text color which doesn't seem to affect that color.
How do I change the default color that is appearing above?
The tint determines this color.
You can change it globally by settting
UINavigationBar.Appearance.TintColor
If you just want to change the color of the menu button in a specific ViewController . Add the following code in the method ViewWillAppear() of your ViewController
public override void ViewWillAppear(bool animated)
{
base.ViewWillAppear(animated);
this.NavigationController.NavigationBar.TintColor = UIColor.FromRGB(xxx,xxx,xxx);
}
NavigationPage has a property called BarTextColor, on iOS devices, this property changes the colour of both the navigation bar text and the menu button text. The following solution might be a problem though if one would like to have separate colours for each of the latter:
MainPage = new NavigationPage(YourPage) { BarBackgroundColor = Color.FromHex(#SomeHex), BarTextColor = Color.Red};
BarTextColor = Color.Red produces the following output:
I want to have a unified toolbar and therefore I found this post:
How can I create Yosemite-style unified toolbar in Interface Builder?
self.window.titleVisibility = NSWindowTitleVisibility.Hidden
works perfect.
But is there a way to change the background color for the toolbar? I tried with self.window.appearance = NSAppearance(named: NSAppearanceNameVibrantDark), but this only brings a complete black toolbar (that's too dark). I want to have a custom color.
This one works:
https://stackoverflow.com/a/28692893/2062613
Set the window to textured in IB (I don't see a possibility to do it at runtime)
Use this code:
self.window.titleVisibility = NSWindowTitleVisibility.Hidden
self.window.backgroundColor = NSColor.whiteColor()
UPDATE:
To prevent, that the toolbar becomes transparent in Yosemite (if you have a scrollview below the Toolbar), use this code:
self.window.appearance = NSAppearance(named: NSAppearanceNameAqua)
I have used this solution to customize the title bar. However, since 10.15.4 and apparently on Big Sur, the toolbar is broken. If you have a toolbar with the window, the toolbar will placed on the top edge of the window, as if there is no title bar.