I'm facing a situation and I can't find the solution, I've a Alloy app, and I've created a 'input' with it's own options, in iOS it shows a popup with a UI.Picker, and in android shows only the UI.Picker like a dropdown, my problem is that the background is dark and the text white, I've tried to add a theme to tiapp.xml and add some properties to it, but nothing changed yet; I also want to apply this in the alert dialogs, this is my tiapp.xml file:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>14</tool-api-level>
<manifest>
<application
android:debuggable="true"
android:largeHeap="true"
android:theme="#style/Theme.MyTheme">
<activity ... ></activity>
</application>
<supports-screens android:anyDensity="true"/>
</manifest>
</android>
This is my app/platform/android/res/values/style.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:editTextStyle">#style/text</item>
<item name="android:spinnerItemStyle">#style/picker</item>
<item name="android:spinnerStyle">#style/picker</item>
<item name="android:spinnerDropDownItemStyle">#style/picker</item>
<item name="android:color">#555</item>
<item name="android:background">#FFF</item>
</style>
<style name="text" parent="#android:style/Widget.EditText">
<item name="android:color">#555</item>
<item name="android:textColor">#555</item>
<item name="android:background">#FFF</item>
</style>
<style name="picker" parent="#android:style/Widget.TextView.SpinnerItem">
<item name="android:color">#555</item>
<item name="android:textColor">#555</item>
<item name="android:background">#FFF</item>
</style>
<style name="alert" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:colorPrimary">#555</item>
<item name="android:textColorPrimary">#555</item>
<item name="android:colorAccent">#555</item>
<item name="colorPrimaryDark">#555</item>
<item name="android:background">#FFF</item>
</style>
</resources>
UPDATE:
This is my iOS picker:
This is my android picker:
Digging through the code at https://github.com/appcelerator/titanium_mobile/blob/415bd6c66dcc55b1a59a59574f3babd3c3a84ede/android/modules/ui/src/java/ti/modules/titanium/ui/widget/picker/TiUINativePicker.java#L93 this component is styled by https://github.com/appcelerator/titanium_mobile/blob/415bd6c66dcc55b1a59a59574f3babd3c3a84ede/android/modules/ui/res/layout/titanium_ui_spinner.xml so you'd need to override that id in your custom theme.
Related
I need to remove scrollbars from the complete application.
I want to avoid the trouble of writing android:scrollbars="none" in all the ScrollViews defined in my application.
Now, here is what I have tried to do :
styles.xml
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:scrollViewStyle">#style/NoScrollbars</item>
<item name="android:scrollbarStyle">#style/NoScrollbars</item>
</style>
<style name="NoScrollbars" parent="android:Widget.ScrollView">
<item name="android:scrollbars">none</item>
</style>
Is there any way to make this happen ?
You can define a ScrollViewStyle and ListViewStyle in your Theme:
<style name="Theme.MyTheme" parent="android:Theme.Holo">
<item name="android:listViewStyle">#style/Widget.MyTheme.ListView</item>
<item name="android:scrollViewStyle">#style/Widget.MyTheme.ScrollView</item>
</style>
<style name="Widget.MyTheme.ListView" parent="android:Widget.ListView">
<item name="android:overScrollMode">never</item>
<item name="android:scrollbars">none</item>
</style>
<style name="Widget.MyTheme.ScrollView" parent="android:Widget.ScrollView">
<item name="android:overScrollMode">never</item>
<item name="android:scrollbars">none</item>
</style>
Then you have to define your Theme in you AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="nouman.app.example"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:targetSdkVersion="16" android:minSdkVersion="8"/>
<application
android:hardwareAccelerated="true"
android:label="#string/app_name"
android:icon="#drawable/ic_launcher"
android:theme="#style/Theme.MyTheme">
That's it. Done.
I'm trying to hide the actionBar for a specific window. I've followed this: http://www.appcelerator.com/blog/2014/08/hiding-the-android-actionbar/ which used to work for me in the past.
What I did was to create a custom theme like this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.NoActionBar" parent="#style/Theme.AppCompat">
<item name="android:windowNoTitle">true</item>
</style>
<style name="Theme.YesActionBar" parent="#style/Theme.AppCompat">
<item name="android:windowNoTitle">false</item>
</style>
</resources>
I've set the following in my tiapp.xml:
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />
</manifest>
</android>
And I've set the following in my window tss:
"Window[platform=android]" : {
theme: 'Theme.NoActionBar'
}
but still the action bar shows. If I hide it from code on window open event than it cuts the background image I have - so I rather do it with a theme.
how can I hide action bar with theme on sdk 5.2.0?
I was able to solve the problem by changing my custom theme to this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.NoActionBar" parent="#style/Theme.AppCompat">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="Theme.YesActionBar" parent="#style/Theme.AppCompat">
<item name="windowActionBar">true</item>
<item name="windowNoTitle">false</item>
</style>
</resources>
I am new to android application development.I used http://android-holo-colors.com/
to create theme for my application.
It created a theme named ei_theme.
I got the drawable folders,layout,and values folder.
The values folder consist of colors_ei_theme,dimens_ei_theme,styles_ei_theme,themes_ei_theme.
Now i am confused what to add in the manifest file to use the theme.
I guess u cant add more than one theme to in application tag in the manifest.
Can u please tell me how to use these.
here are the contents of styles_ei_theme
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with http://android-holo-colors.com -->
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-<style parent="android:Widget.Holo.AutoCompleteTextView" name="AutoCompleteTextViewEi_Theme">
<item name="android:dropDownSelector">#drawable/ei_theme_list_selector_holo_dark</item>
<item name="android:background">#drawable/ei_theme_edit_text_holo_dark</item>
</style>
-<style parent="android:Widget.Holo.Button" name="ButtonEi_Theme">
<item name="android:background">#drawable/ei_theme_btn_default_holo_dark</item>
</style>
-<style parent="android:Widget.Holo.ImageButton" name="ImageButtonEi_Theme">
<item name="android:background">#drawable/ei_theme_btn_default_holo_dark</item>
</style>
-<style name="TabEi_Theme">
<item name="android:gravity">center_horizontal</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
<item name="android:background">#drawable/ei_theme_tab_indicator_holo</item>
<item name="android:layout_width">0dip</item>
<item name="android:layout_weight">1</item>
<item name="android:minWidth">80dip</item>
</style>
-<style name="TabTextEi_Theme">
<item name="android:textColor">#ffffff</item>
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
<!-- v14 <item name="android:textAllCaps">true</item> -->
<item name="android:ellipsize">marquee</item>
<item name="android:maxLines">2</item>
<item name="android:maxWidth">180dip</item>
</style>
</resources>
here are contents of themes_ei_theme
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with http://android-holo-colors.com -->
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-<style parent="android:Theme.Holo" name="Ei_Theme">
<item name="android:editTextBackground">#drawable/ei_theme_edit_text_holo_dark</item>
<item name="android:textColorHighlight">#9933b5e5</item>
<item name="android:textSelectHandleLeft">#drawable/ei_theme_text_select_handle_left</item>
<item name="android:textSelectHandleRight">#drawable/ei_theme_text_select_handle_right</item>
<item name="android:textSelectHandle">#drawable/ei_theme_text_select_handle_middle</item>
<item name="android:autoCompleteTextViewStyle">#style/AutoCompleteTextViewEi_Theme</item>
<item name="android:listChoiceIndicatorMultiple">#drawable/ei_theme_btn_check_holo_dark</item>
<item name="android:listChoiceIndicatorSingle">#drawable/ei_theme_btn_radio_holo_dark</item>
<item name="android:buttonStyle">#style/ButtonEi_Theme</item>
<item name="android:imageButtonStyle">#style/ImageButtonEi_Theme</item>
</style>
</resources>
There are two ways to apply theme to your activity through AndroidManifest.xml file.
1- Apply theme in the application tag. This applies this theme to all activities in the application like:
<application
android:theme = "#style/Ei_Theme" >
...
</application>
2- Apply theme to each activity individually in AndroidManifest.xml under application tag. This applies this theme to only this activity:
<application >
<activity
android:theme = "#style/Ei_Theme" >
...
</activity>
</application>
I've created the bellow style to change the selection handles on an EditText.
<style name="AutoCompleteTextViewOrangeAutoComplete" parent="android:Widget.Holo.Light.AutoCompleteTextView">
<item name="android:dropDownSelector">#drawable/orangeautocomplete_list_selector_holo_light</item>
<item name="android:background">#drawable/orangeautocomplete_edit_text_holo_light</item>
<item name="android:textSelectHandle">#drawable/orangehandle_text_select_handle_middle</item>
<item name="android:textSelectHandleLeft">#drawable/orangehandle_text_select_handle_left</item>
<item name="android:textSelectHandleRight">#drawable/orangehandle_text_select_handle_right</item>
<item name="android:textColorHighlight">#99db4b39</item>
</style>
On my layouts, some of my TextViews can be selected so I want to apply the same selection handles but since I have many TextViewsI would like to apply the handles to all of my app.
On AndroidManifest I have this:
<activity
android:name=".Fragments"
android:exported="false"
android:label="#string/app_name"
android:theme="#style/myTheme">
And on Values-v14 my styles.xml is like this:
<resources>
<style name="myTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:textViewStyle">#style/test</item>
</style>
<style name="test" parent="android:Widget.Holo.Light.TextView">
<item name="android:textSelectHandle">#drawable/orangehandle_text_select_handle_middle</item>
<item name="android:textSelectHandleLeft">#drawable/orangehandle_text_select_handle_left</item>
<item name="android:textSelectHandleRight">#drawable/orangehandle_text_select_handle_right</item>
<item name="android:textColorHighlight">#99db4b39</item>
</style>
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"/>
</resources>
Unfortunately this is not changing the default text selection handles.
Any idea how to make it work?
I created a custom title bar for my application but I am having some problems implementing it. I want to change the color and the appearance for the text and title bar
The layout of the styles.xml is as below:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme">
<item name="android:tabWidgetStyle">#style/LightTabWidget</item>
</style>
<style name="MyWindowTitleBackground" parent="#android:style/WindowTitleBackground">
<item name="android:background">#android:drawable/title_bar</item>
</style>
<style name="MyWindowTitle" parent="#android:style/WindowTitle">
<item name="android:singleLine">true</item>
<item name="android:windowTitleSize">40dip</item>
<item name="android:textAppearance">#style/MyTextAppearance</item>
<item name="android:shadowColor">#BB000000</item>
<item name="android:shadowRadius">2.75</item>
</style>
<style name="MyTextAppearance" parent="#android:style/TextAppearance.WindowTitle">
<item name="android:textColor">#3A6629</item>
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="LightTabWidget" parent="#android:style/Widget.TabWidget">
<item name="android:textSize">20px</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#FF5721</item>
</style>
</resources>
And I have added that theme in the manifest file as follows:
<application android:icon="#drawable/icon" android:label="#string/app_name" android:theme="#android:style/Theme.Light">
<activity android:name="LAFoodBankAboutUs" android:label="#string/app_name" android:theme="#style/MyTheme">
What do I have to do to show the custom title bar?
By now (after some years), the Toolbar is available. It features a lot of customization possibilities and is also available via the Support Library