Set "Splash Screen" color for Android TV App - android-tv

How can I set/change the color of this animated screen for my app?

OK, Finally I've figured it out.
This color is taken from Theme. You should overwrite the android:colorPrimary to change this color.

This is called "Changing Launcher color"
To customize the color of this animation, set the android:colorPrimary attribute of your TV app or activity to a specific color.
<resources>
<style ... >
<item name="android:colorPrimary">#color/primary</item>
</style>
</resources>
For More info, you can check this link
https://developer.android.com/training/tv/start/start.html

Related

Xamarin.Forms disable Shell TabBar font scale when selected

Is there any way to disable behavior of tab bar scaling font size for selected items on Android?
It cuts off titles when selected which is very annoying.
I could not find TabBar renderer kind of thing to change behavior on Android side.
The last item 'Notificaitons' are being cut to 'Notificatio' when it is selected.
Create a dimens.xml in Android> Resource> values. And then add the following XML to override the size of the text when it is active and not active:
<?xml version="1.0" encoding="utf-8" ?>
<resources xmlns:tools="http://schemas.android.com/tools">
<dimen name="design_bottom_navigation_text_size" tools:override="true">12sp</dimen>
<dimen name="design_bottom_navigation_active_text_size" tools:override="true">12sp</dimen>
</resources>
Before:
After:

Xamarin Forms Shell Textcolor in Android Modal is not applied

I have a Xamarin Forms Shell Application in which I open several pages as Modal. I would like to set the bar text color to a chosen value so, that you can actually read the text in the dark and the light theme. This is the navigation code:
return shell.Navigation.PushModalAsync(new NavigationPage(page)
{
BarBackgroundColor = Color.Transparent,
BarTextColor = Color.Red
});
(Red is only as an example to clearly be able to see the color change).
On iOS the color is adjusted as expected:
But on Android the color stays always white:
Open your styles.xml file, add <item name="android:actionMenuTextColor">#ff0000</item> in your Theme.AppCompat.DayNight.NoActionBar style.
<style name="MyTheme.Base" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/orange</item>
<item name="colorPrimaryDark">#color/orangeDark</item>
<item name="colorAccent">#color/colorAccent</item>
<!--<item name="android:textColorPrimary">#fb2b32</item>-->
<item name="android:actionMenuTextColor">#ff0000</item>
</style>
Here is running screenshot.

Change icon from jQuery UI to FontAwesome in PrimeFaces

I have a PrimeFaces p:tree and I was able to add font awesome expanded and collapsed icons using this, but there is an arrow icon before that which is from PrimeFaces and I was not able to figure out how to switch it font awesome arrows (fa-arrow-circle-down and fa-arrow-circle-right), or changing the color to white also suffices my need.
I have looked at the Firebug and found that the PrimeFaces arrow is from an image url("/permitweb-1.0/faces/javax.faces.resource/images/ui-icons_616161_256x240.png?ln=primefaces-aristo") I am not sure I can change the color of the image without creating or importing a new image.
I looked at other posts here because PrimeFaces was using an image and FontAwesome is CSS, I am not sure how to replace the arrow, TreeNode doesn't have a setIcon method like MenuItem.
Here is my tree code:
<p:tree selectionMode="single">
<p:treeNode expandedIcon="fa fa-folder-open" collapsedIcon="fa fa-folder">
<h:outputText value="Home" />
</p:treeNode>
<p:treeNode type="document" icon="fa fa-file-text-o fileColor">
<h:outputText value="Staff" />
</p:treeNode>
</p:tree>
Tree arrow icon:
Try my FontAwesomeResourceHandler.
This resource handler will strip the jQuery UI icons from the community PrimeFaces themes and adds FontAwesome rules to
the theme. You can use it on existing applications without needing to convert all XHTML (for example ui-icon-gear to
fa fa-cog). The injected CSS will map all the UI icons.
Add this dependency to your pom.xml:
<dependency>
<groupId>com.github.jepsar</groupId>
<artifactId>primefaces-theme-jepsar</artifactId>
<version>0.9.1</version>
</dependency>
Then, in the faces-config.xml, add the handler:
<application>
<resource-handler>org.jepsar.primefaces.theme.jepsar.FontAwesomeResourceHandler</resource-handler>
</application>
Another way I tried was using the icons from another primefaces theme which has white icon arrows. This is just another way if you find the right color for your arrow icons in another theme. Otherwise I would go for Jasper's solution for a clean one for a custom image. Just posting this an another alternative.
I am using primefaces-aristo and found white arrow icons in primefaces-black-tie, so I override the arrow icons with that theme image.
.navTree > .ui-treenode-content > .ui-tree-toggler {
background-image: url("#{resource['primefaces-black-tie:images/ui-icons_ededed_256x240.png']}");
}

Center text of a Xamarin Forms TabbedPage Title

i have a TabbedPage with multiple Child-Pages, with a title each.
When the title is short enough to be single line the text gets centered perfectly, but as soon as the text needs more than 1 line it is no longer centered.
Can anyone tell me how to fix this?
I think it's impossible to do in common way for all platforms, and you have to do it in platform specific way.
For android project I did it in such way:
In file Styles.xml from folder Resources/values I added style
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomTheme"
parent="#android:style/Theme.Holo">
<item name="android:actionBarTabTextStyle">#style/CustomTab</item>
</style>
<style name="CustomTab"
parent="#android:style/Widget.Holo.ActionBar.TabText">
<item name="android:gravity">center</item>
</style>
</resources>
And in MainActivity.cs I added
[Activity(Theme = "#style/CustomTheme")]
For Windows phone I found this article https://nocture.dk/2014/12/10/xamarin-forms-customizing-tabbed-page-header-title-windows-phone/, but didn't try it.
For iOS i didn't check too http://jfarrell.net/2015/02/25/customizing-the-tab-bar-on-ios-with-xamarin-forms/.

Xamarin Forms Button TextColor behaves differently on Android than an iOS

I want a button's text color to be the same on both iOS and Android. So I thought I'd just set the TextColor property in code to the color I wanted. On iOS, the disabled text color is still grey (which is what I want), however, on Android, the disabled text color is the same as the enabled text color. How do I make the disabled text color on Android grey (or whatever its default is for a disabled button)?
Thanks
That is the default behavior in Xamarin.Forms. To work around that and achieve a custom color, you can:
use triggers to change the color when going from enabled to disabled and vice versa
manually set the color when enabling and disabling the button
use a custom renderer
Because triggers are the most straightforward and consistent way of achieving what you want, I'll only cover that. You can see the xamarin docs for more information about custom renderers.
Using triggers, you can dynamically change the font color to gray when it is not enabled. See the docs for more information about triggers.
<Button Text="I am a Button">
<Button.Triggers>
<Trigger TargetType="Button"
Property="IsEnabled" Value="true">
<Setter Property="TextColor" Value="Red" />
<!-- red is the desired color when the button is enabled.-->
</Trigger>
<Trigger TargetType="Button"
Property="IsEnabled" Value="false">
<Setter Property="TextColor" Value="Gray" />
<!-- gray is the desired color when the button is disabled.-->
</Trigger>
</Button.Triggers>
</Button>
If above does not work for you, you could try to check this workaround. It uses a custom renderer and NSAttributedString for setting the title in disabled state

Resources