Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17563] Android: Image incorrectly sized when using windowBackground with custom theme

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionNot Our Bug
Resolution Date2014-09-04T17:21:01.000+0000
Affected Version/sRelease 3.3.0
Fix Version/sn/a
ComponentsAndroid
LabelsSupportTeam
ReporterMauro Parra-Miranda
AssigneePing Wang
Created2014-08-26T21:41:50.000+0000
Updated2017-03-10T21:19:17.000+0000

Description

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.

Attachments

FileDateSize
Image1.png2014-08-26T21:41:50.000+0000348661
Image2.png2014-08-26T21:41:50.000+000029367

Comments

  1. Ping Wang 2014-09-04

  2. Ingo Muschenetz 2014-09-17

    Making public again. Removed attachment (as it's not truly necessary)
  3. Lee Morris 2017-03-10

    Closing ticket as it is not our bug.

JSON Source