Problem Description
There is a strange behavior when using custom theme, basically if you don't use this one:
<item name="android:windowBackground">@drawable/splash</item>
it will fail (it shows a smaller screen/view in android) - Check Image1.png
If you remove it, it will work just fine. - Check Image2.png
Steps to reproduce
1. Create a new mobile project (classic titanium)
2. Add this app.js:
var mainView = Ti.UI.createView({
layout: 'vertical',
height: Ti.UI.FILL
});
var textField = Ti.UI.createTextField({
top: 10,
autocapitalization: Titanium.UI.TEXT_AUTOCAPITALIZATION_NONE,
autocorrect: false
});
mainView.add(textField);
var validateButton = Ti.UI.createButton({
top: 15,
left: 8,
right: 8,
title: 'Validate content'
});
mainView.add(validateButton);
validateButton.addEventListener("click", function () {
if (validateTextFieldCommand) {
validateTextFieldCommand(textField.value);
}
});
var win = Ti.UI.createWindow({backgroundColor:'blue'});
win.add(mainView);
win.open();
Add this to your mytheme.xml (inside platform->android->res->values):
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.MyTheme" parent="@style/Theme.AppCompat">
<!-- <item name="android:windowBackground">@drawable/splash</item>-->
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:editTextStyle">@style/editText</item>
</style>
<style name="editText" parent="@android:style/Widget.EditText">
<item name="android:textCursorDrawable">@null</item>
</style>
</resources>
Specify in tiapp.xml which theme you going to use (excerpt):
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest android:installLocation="auto" android:versionCode="1" android:versionName="894">
<application android:debuggable="true"
android:icon="@drawable/appicon"
android:label="@string/appname" android:largeHeap="true"
android:screenOrientation="portrait" android:theme="@style/Theme.MyTheme">
</application>
</manifest>
</android>
3. Run it into device.
Actual results
if you enable the windowBackground in the custom theme, the views will be smaller.
Extra info
I attached a full testcase in the form of a project with the name viewport-3-3-0-reduced.zip.
Making public again. Removed attachment (as it's not truly necessary)
Closing ticket as it is not our bug.