I have the following index.xml
<Alloy>
<Window id="container" title="My App">
<View backgroundImage="/myBackground.jpg">
<Label backgroundColor='rgba(0,0,0,0.5)' text="Hello world!"></Label>
</View>
</Window>
</Alloy>
As the documentation says, that should provide me with a Hello World text with a semi-transparent black background. In iOS works fine but it shows a totally transparent background on Android.
I tried putting it in a separate tss file but still the same issue. Any ideas out there?
For some reason android compilations in Titanium don't work well with rgba() syntax for colors. Try the Hex version instead:
<Alloy>
<Window id="container" title="My App">
<View backgroundImage="/myBackground.jpg">
<Label backgroundColor='#50000000' text="Hello world!"></Label>
</View>
</Window>
</Alloy>
Related
I have created a Xamarin Android Shell app. All the labels and Entries are in blank color and don't display on the android device until I change it to black or other colors. Below is a code snippet for the login page.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="VaxineApp.Views.Login.LoginPage"
xmlns:local="clr-namespace:VaxineApp.Renderers"
Shell.FlyoutBehavior="Disabled"
Shell.NavBarIsVisible="False">
<ContentPage.Content>
<StackLayout Padding="40" VerticalOptions="Center" HorizontalOptions="FillAndExpand">
<Label Text="Welcome to Login Page" />
<Entry Placeholder="Email or Phone"></Entry>
<Entry Placeholder="Password"></Entry>
<Button Text="Sign in"></Button>
</StackLayout>
</ContentPage.Content>
</ContentPage>
I don't know whether I am missing something. That hasn't happened to me before.
See how this code renders on my Android device.
Page markup
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage NavigationPage.HasNavigationBar="false" xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ConnectedLifeView.NativeApp.Pages.LoginSuccessPage">
<ContentPage.Content>
<StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Margin="0" Padding="0">
<WebView x:Name="webView" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="#02114D"/>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Output
I tried adding background color to content page and setting WebView background color to Transparent but it has no effect either.
My all other pages have proper background but this page looks a bit weird as it shows white background while the URL loads in WebView.
Xamarin.Forms version: 4.2.0.815419
Platform: Android
If you want to change webview background color, another way is to use custom render.
public class TransparentWebViewRenderer:WebViewRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)
{
base.OnElementChanged(e);
// Setting the background as transparent
this.Control.SetBackgroundColor(Android.Graphics.Color.AliceBlue);
}
}
Have a problem with Picker style - it has underline like TextInput on Android, but underlineColorAndroid = 'transparent' or any other color isn't working.
I'm using Picker from NativeBase, and this Picker replaces ReactNative Picker. So here is my code. I've tryed wrapped Item with Input(NativeBase) or TextInput with underlineColorAndroid property, because only TextInput can have this prop, but has no luck. Changing styles of the components with bottomBorderColor doesn't give a result too. Can anyone help me please?
<View>
<Form>
<Item inlineLabel>
<Label>Region</Label>
<Picker
style={{ alignItems: 'flex-end', width: 200 }}
placeholder='...'
>
<Picker.Item label="..."/> //this first Item rendered as underlined
</Picker>
</Item>
</Form>
</View>
Add style={{borderColor:"transparent"}} to the <Item> tag.
<View>
<Form>
<Item inlineLabel style={{borderColor: "transparent"}}>
<Label>Region</Label>
<Picker
style={{ alignItems: 'flex-end', width: 200 }}
placeholder='...'
>
<Picker.Item label="..."/> //this first Item rendered as underlined
</Picker>
</Item>
</Form>
</View>
Wondering if anyone else has run into the following issue.
I've got my App.MainPage wrapped in a navigation page
MainPage = new NavigationPage(new MyPage());
From MyPage I navigate to a user account page which is a TabbedPage
await Navigation.PushAsync(new MyAccountTabbedPage());
and here's the xaml (pretty simple)
<TabbedPage.Children>
<userAccount:SitesTab />
<userAccount:ProjectsTab />
<userAccount:SettingsTab />
</TabbedPage.Children>
Now here's where it gets fun. From within my SitesTab, I need to show a ListView that contains ContextActions
<AbsoluteLayout>
<ListView AbsoluteLayout.LayoutBounds="0,0,1,1"
AbsoluteLayout.LayoutFlags="All"
ItemsSource="{Binding ListItems}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.ContextActions>
<MenuItem Text="Do Stuff"/>
<MenuItem Text="Delete Stuff" IsDestructive="True"/>
</ViewCell.ContextActions>
<StackLayout>
<Label Text="{Binding .}"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</AbsoluteLayout>
The issue I'm running up against is that the context action on Android doesn't cover/replace the NavigationBar, but rather pushes it down and screws everything up.
Before Context
After Context
So what's up here? Has anyone figured out a way around this? That context menu at the top of the page should cover over the NavigationBar instead of push everything down.
turns out I needed the following in my app compat theme
<style name="myActivityTheme" parent="Theme.AppCompat.NoActionBar">
<item name="windowActionModeOverlay">true</item>
</style>
I'm building an app with appcelerator studio for Android system.
So I want to display and customize a ToolBar.
So this is my index.xml layout:
<Alloy>
<Window class="container">
<ActionBar id="actionbar" title="" icon="/images/logo_decipher.png" />
<Menu>
<MenuItem id="item1" title="Settings" />
<MenuItem id="item2" title="Search" />
</Menu>
</Window>
</Alloy>
I want to display my personal Image in this Toolbar. I'm try to use tag icon but not works.
You can use actionbarExtras. https://github.com/ricardoalcocer/actionbarextras/blob/master/documentation/index.md
Ray