In my Xamarin project I have many static resources styles defined. This worked perfectly in my Nougat emulator. Suddenly, after upgrading to Oreo 8.1, I discovered the style are not set anymore.
I use the latest update of Visual Studio 2017.
As an example I defined a style in the App.xaml as follow:
<!-- Application resource dictionary -->
<ResourceDictionary>
<Style x:Key="pageStyle" TargetType="ContentPage">
<Setter Property="BackgroundColor" Value="Black" />
</Style>
<Style x:Key="headerStyle" TargetType="Label">
<Setter Property="HorizontalOptions"
Value="CenterAndExpand" />
<Setter Property="VerticalOptions"
Value="Start" />
<Setter Property="FontSize" Value="Large" />
<Setter Property="FontAttributes" Value="Bold" />
<Setter Property="TextColor" Value="Yellow" />
</Style>
</ResourceDictionary>
In my content page, I consumed this style at this way:
<Label Text="Nieuwe bestelling"
VerticalOptions="Start"
Style="{StaticResource headerStyle}" />
My problem is that the headerStyle doesn't work. No error message will be displayed and the style is not set in my Android project.
Can anyone help me?
Thanks,
Marcel
Related
I am Searching for a proper fix on how to change the Color of the Pickers (Date & Time) in Xamarin Forms. I already have the Custom Renderer to customize the Dialog, but is there also a similar possibility to customize the Background Color of the displayed Picker itself(and the annoying Pink line) on all Instances at once?
I found out how to make it, but my solution is not that elegant since i have to define the Background Color on each Instance throughout the App.
-> i want the Blue Box behind the 16:00 to disappear
the code to the picture i have as follows:
<TimePicker Grid.Row="5"
Grid.Column="0"
x:Name="BtnTime2"
Format="t"/>
<Button Grid.Row="5"
Grid.Column="1"
x:Name="BtnTime2Now"
CornerRadius="15"/>
<DatePicker Grid.Row="6"
Grid.Column="0"
Grid.ColumnSpan="2"
x:Name="BtnDate"
Format="D"
BackgroundColor="#00000000"/>
Hope anybody of you guys can help me
ok nevermind...
i already had the solution in my App.xaml
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Arbeitszeitrechner_Forms.App">
<Application.Resources>
<ResourceDictionary>
...some more Styles here...
<Style TargetType="TimePicker">
<Setter Property="BackgroundColor" Value="#00000000"/>
<Setter Property="TextColor" Value="{StaticResource Text}"/>
</Style>
<Style TargetType="DatePicker">
<Setter Property="BackgroundColor" Value="#00000000"/>
<Setter Property="TextColor" Value="{StaticResource Text}"/>
</Style>
</ResourceDictionary>
</Application.Resources>
After reading the React Native documentation I understood that selectionColor was used to change the color of the cursor instead of that primary default color of android system.
So I tried the following:
<TextInput selectionColor="#2E5BFF" {...props} autoCapitalize="none" autoCorrect={false} />
The problem is that on android devices it still gets that green default color of android, on the emulator tought its fine and is showing #2E5BFF color. My android devices both have android P.
Is there any known bug or am I doing something wrong here?
EDIT
I'm using Expo SDK 32.0.0
You can set colorControlActivated in styles.xml file.Like this
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#color/kio_turquoise</item>
<item name="colorPrimaryDark">#color/kio_hot_pink</item>
<!-- sets cursor color -->
<item name="colorControlActivated">#android:color/black</item>
</style>
because the backbone of the app is the native android application. For more information you can refer this article. It is very helpful.
React native on android styling the cursor
<TextInput
selectionColor={global.COLOR.DARKBLUE}
underlineColorAndroid={global.COLOR.ORANGE}
autoCapitalize="none" autoCorrect={false} />
you can try this
I have the following global style that I hoped would turn off the button borders on Android:
<Style TargetType="Button">
<Setter Property="BorderWidth" Value="0" />
<Setter Property="BackgroundColor" Value="Transparent" />
<Setter Property="BorderColor" Value="Transparent" />
<Setter Property="BorderRadius" Value="0"/>
</Style>
On Android API 19, everything looks fine. On API 23 device, I get borders around the buttons:
Any idea how to get rid of these?
Unfortunately I had no choice but to change the buttons to StackLayouts and attach a gesture recognizer to the StackLayout similar to the following:
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="btnMore_Clicked"/>
</StackLayout.GestureRecognizers>
While it sucks - it basically means anyone who wants to use the Xamarin Forms button controls with a transparent background - STOP - it will not work correctly on the newer Android platforms. Just save yourself the trouble and use a simpler control and attached a gesture recognizer to it.
Black screen came for 2 seconds when starting app in phonegap in android before the splash screen came. How to resolve this problem? I need splash screen immediately.
You need to create a new theme to the android app.
Under "{Project}\res\values" create a new file "styles.xml" and put the contents of the attached image
In the AndroidManifest.xml add "android:theme="#style/Theme.MyAppTheme"" to the "application" tag
Simply you can't.
That black screen is a sort of Android internal base screen that Android shows for your app while it fork a process in the Dalvik JVM and load your resources/classes. it happen for any Android app. it is not related to Phonegap.
Android make this to give the user the impression of a "fast app launch" while it instead is still loading your code.
Anyway you can style that black screen to make it appear as near as possible to the theme of your app so the user have the impression the app is ready and launched but it is loading internal content.
You can read more about it here:
http://cyrilmottier.com/2013/01/23/android-app-launching-made-gorgeous/
I had the same problem. Here's I solved it:
Install the "org.apache.cordova.splashscreen" plugin
Add these lines to your config.xml:
<preference name="AutoHideSplashScreen" value="false"/>
<preference name="SplashScreenDelay" value="10000" />
<gap:plugin name="org.apache.cordova.splashscreen" />
Change the config.xml's XML namespace from xmlns:cdv="http://cordova.apache.org/ns/1.0 to xmlns:gap="http://phonegap.com/ns/1.0, if not done so already.
<resources>
<style name="AppBaseTheme" parent="android:Theme.Light" />
<style name="Theme" parent="android:style/Theme" />
<style name="Theme.MyAppTheme" parent="Theme">
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowBackground">#drawable/screen</item>
</style>
</resources>
I am trying to customize spinner. I found this tutorial, http://www.gersic.com/blog.php?id=57
It looks great but I am finding some errors all of which is like the following
error: No resource identifier found for attribute 'state_dropdown_showing' in package 'android'
and the xml which leads to this error is
<!-- DROPDOWN SHOWING-->
<item android:state_first="true"
android:state_dropdown_showing="true"
android:drawable="#drawable/btn_dropdown_down"
/>
<item android:state_middle="true"
android:state_dropdown_showing="true"
android:drawable="#drawable/btn_dropdown_up_down"
/>
<item android:state_last="true"
android:state_dropdown_showing="true"
android:drawable="#drawable/btn_dropdown_up"
/>
<item android:state_single="true"
android:state_dropdown_showing="true"
android:drawable="#drawable/btn_dropdown_neither_up_down"
/>
<!-- DROPDOWN NOT SHOWING-->
<item android:state_first="true"
android:state_dropdown_showing="false"
android:drawable="#drawable/btn_dropdown_right_only"
/>
<item android:state_middle="true"
android:state_dropdown_showing="false"
android:drawable="#drawable/btn_dropdown_left_right_collapsed"
/>
<item android:state_last="true"
android:state_dropdown_showing="false"
android:drawable="#drawable/btn_dropdown_left_only"
/>
<item android:state_single="true"
android:state_dropdown_showing="false"
android:drawable="#drawable/btn_dropdown_neither"
/>
And I am not finding anything in the net relevant to this. I am at a fix now. I want to change the look and feel of the regular spinner with nice color background.
Anybody please guide me about customization of spinner.
android:state_dropdown_showing it is worked on after r15 version only..so update the android sdk tools version.it is hopefully helpful to all