Skip to content

Instantly share code, notes, and snippets.

@MotiurRahman
Last active October 11, 2019 13:53
Show Gist options
  • Save MotiurRahman/70474898226636243d81f852fd1e0b06 to your computer and use it in GitHub Desktop.
Save MotiurRahman/70474898226636243d81f852fd1e0b06 to your computer and use it in GitHub Desktop.
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow({
exitOnClose : true,
layout : 'vertical',
backgroundColor : 'red'
});
var picker = Ti.UI.createPicker({
top : 50,
//color : 'green',
//backgroundColor : 'green' // why???
});
var data = [];
data[0] = Ti.UI.createPickerRow({
title : 'Bananas'
});
data[1] = Ti.UI.createPickerRow({
title : 'Strawberries'
});
data[2] = Ti.UI.createPickerRow({
title : 'Mangos'
});
data[3] = Ti.UI.createPickerRow({
title : 'Grapes'
});
picker.add(data);
picker.selectionIndicator = true;
win.add(picker);
win.open();
// must be after picker has been displayed
picker.setSelectedRow(0, 2, false);
// select Mangos
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="light_steel_blue">#B0C4DE</color>
<color name="pale_turquoise">#AFEEEE</color>
<color name="greenYellow">#ADFF2F</color>
<color name="light_blue">#ADD8E6</color>
<color name="dark_gray">#A9A9A9</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Example" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="android:spinnerDropDownItemStyle">@style/spinner</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
</style>
<style name="spinner" parent="Widget.AppCompat.Light.DropDownItem.Spinner">
<item name="android:background">@color/light_blue</item>
</style>
</resources>
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<application android:theme="@style/Theme.Example"/>
<uses-sdk android:minSdkVersion="16" android:targetSdkVersion="28"/>
</manifest>
</android>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment