Tianium Android:CalendarView显示不适用于Android 5.x及更高版本
我一直在尝试Android中的日期选择器,它工作得非常好,我的问题是CalendarViewShowed属性。我需要在所有版本的android中使用老式的日期选择器,这在android 4和更低版本中都是默认的,但是当我们在android 5和更高版本上运行应用程序时,默认的日期选择器会显示日历,而我希望使用旧的日期选择器。 为此,我使用了属性CalendarViewShowed,如下图所示,我没有得到预期的结果Tianium Android:CalendarView显示不适用于Android 5.x及更高版本,android,android-5.0-lollipop,appcelerator-titanium,android-calendar,android-datepicker,Android,Android 5.0 Lollipop,Appcelerator Titanium,Android Calendar,Android Datepicker,我一直在尝试Android中的日期选择器,它工作得非常好,我的问题是CalendarViewShowed属性。我需要在所有版本的android中使用老式的日期选择器,这在android 4和更低版本中都是默认的,但是当我们在android 5和更高版本上运行应用程序时,默认的日期选择器会显示日历,而我希望使用旧的日期选择器。 为此,我使用了属性CalendarViewShowed,如下图所示,我没有得到预期的结果 <Alloy> <Window class="container
<Alloy>
<Window class="container">
<View backgroundColor="black" height="Ti.UI.SIZE" width="Ti.UI.SIZE">
<Picker calendarViewShown="false" nativeSpinner="true" type="Ti.UI.PICKER_TYPE_DATE" datePickerMode="spinner"></Picker>
</View>
</Window>
</Alloy>
我终于找到了解决此问题的方法,我们必须使用主题和选择器来使用defaulf日期选择器。请查看以下代码: ****xml代码****
<Alloy>
<Window id="win" title="" backgroundColor="transparent">
<View height="100%" width="100%" backgroundColor="transparent" id="backView"></View>
<View height="Ti.UI.SIZE" layout="vertical" backgroundColor="#f2f2f2" width="90%">
<Label id="currentDate" top="10" color="#000" bottom="10" left="20"></Label>
<View height="1" left="0" right="0" backgroundColor="#d9d9d9"></View>
<View id="pickerView" height="Ti.UI.SIZE"></View>
<Picker calendarViewShown="false" nativeSpinner="true" type="Ti.UI.PICKER_TYPE_DATE" backgroundColor="#f2f2f2" id="androidPicker" width="Ti.UI.FILL"></Picker>
<View height="1" left="0" right="0" backgroundColor="#d9d9d9"></View>
<View height="40dp">
<View height="40dp" width="50%">
<Label id="cancelButton" color="#000" right="20dp" onClick="closeWindow">Cancel</Label>
</View>
<View height="40dp" width="50%">
<Label id="doneButton" color="#000" onClick="getDatePicker">Done</Label>
</View>
</View>
</View>
</Window>
</Alloy>
<style name="Theme.Transparent" parent="@android:style/Theme.Holo.Light.Dialog">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
取消
多恩
在platfrom>>custometheme.xml中的主题文件中粘贴以下样式
****主题****
<Alloy>
<Window id="win" title="" backgroundColor="transparent">
<View height="100%" width="100%" backgroundColor="transparent" id="backView"></View>
<View height="Ti.UI.SIZE" layout="vertical" backgroundColor="#f2f2f2" width="90%">
<Label id="currentDate" top="10" color="#000" bottom="10" left="20"></Label>
<View height="1" left="0" right="0" backgroundColor="#d9d9d9"></View>
<View id="pickerView" height="Ti.UI.SIZE"></View>
<Picker calendarViewShown="false" nativeSpinner="true" type="Ti.UI.PICKER_TYPE_DATE" backgroundColor="#f2f2f2" id="androidPicker" width="Ti.UI.FILL"></Picker>
<View height="1" left="0" right="0" backgroundColor="#d9d9d9"></View>
<View height="40dp">
<View height="40dp" width="50%">
<Label id="cancelButton" color="#000" right="20dp" onClick="closeWindow">Cancel</Label>
</View>
<View height="40dp" width="50%">
<Label id="doneButton" color="#000" onClick="getDatePicker">Done</Label>
</View>
</View>
</View>
</Window>
</Alloy>
<style name="Theme.Transparent" parent="@android:style/Theme.Holo.Light.Dialog">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
真的
@android:彩色/透明
@空的
真的
真的
真的
希望它也适用于其他人