You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I am having a problem, where my listpicker cant change the color of the text, it remains the default black. I would like it to be white, as the background is dark.
I have been looking at trying to interface with the native apis, I am using android. But when I get the elementRef from @ViewChild the object does not have an android attribute, therefore I cannot call the native functions on the object, which I believe to be a numberPicker.
Hi @u14040426,
Thank you for reporting this issue.
Setting foreground color for the ListPicker in NativeScript has been not supported at the moment. Our developer's team will investigate, how it is possible to implement this functionality for both Android and iOS. This feature will be available in some of the next NativeScript versions. As workaround for Android you could review the attached example below. Unfortunately at this time, there is no easy way to set foreground color for iOS. Workaround Android
main-page.xml
import { EventData } from 'data/observable';
import { Page } from 'ui/page';
import { HelloWorldModel } from './main-view-model';
import {ListPicker} from "ui/list-picker";
import {Color} from "color";
import {isAndroid, isIOS} from "platform"
export function navigatingTo(args: EventData) {
let page = <Page>args.object;
var arr=["item1", "item2", "item3"];
page.bindingContext ={"items":arr};
}
export function listpickerLoaded(args){
var picker = <ListPicker> args.object;
console.log("------------------------------------ListPicker-----------------------------------------")
var color = new Color("red");
if(isAndroid){
var count = picker.android.getChildCount();
for(var x=0; x<count; x++){
var selectorWheelPaintField = picker.android.getClass().getDeclaredField("mSelectorWheelPaint");
selectorWheelPaintField.setAccessible(true);
selectorWheelPaintField.get(picker.android).setColor(color.android);
picker.android.getChildAt(x).setTextColor(color.android);
}
}
}
Activity
tsonevn commentedon Dec 1, 2016
From @u14040426 on November 22, 2016 18:53
I have been looking at trying to interface with the native apis, I am using android. But when I get the elementRef from
@ViewChildthe object does not have an android attribute, therefore I cannot call the native functions on the object, which I believe to be a numberPicker.tsonevn commentedon Dec 1, 2016
Hi @u14040426,
Thank you for reporting this issue.
Setting foreground color for the
ListPickerin NativeScript has been not supported at the moment. Our developer's team will investigate, how it is possible to implement this functionality for bothAndroidand iOS. This feature will be available in some of the next NativeScript versions. As workaround for Android you could review the attached example below. Unfortunately at this time, there is no easy way to set foreground color for iOS.Workaround Android
main-page.xml
main-page.ts
NativeScript Angular 2
HTML
TypeScript
Hope this helps
zh-m commentedon Dec 2, 2016
Being resolved with ListPicker respects color and bckgColor set from CSS
u14040426 commentedon Dec 2, 2016
@zh-m Awesome, thank you. I have seen that the code has passed all tests. How long will it take to be merged into master?
u14040426 commentedon Dec 2, 2016
@zh-m It works perfectly, by the way.
zh-m commentedon Dec 5, 2016
Hey @u14040426,
The PR has been merged.
lock commentedon Aug 29, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.