Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-8456] Android: ScollView doesn't show added component

GitHub Issuen/a
TypeBug
PriorityLow
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 2.0.0, Release 2.0.1, Release 3.1.0
Fix Version/sn/a
ComponentsAndroid
Labelsn/a
ReporterIvan Skugor
AssigneeUnknown
Created2012-03-29T03:35:05.000+0000
Updated2018-02-28T20:04:01.000+0000

Description

The problem

ScrollView component does not function well and its behavior defers from basic View component. If View is added to ScrollView and it is positioned to the bottom (by using combination of ScrollView's absolute layout and View's bottom property), View is not shown on the screen. If TextField is present on the screen, and it is pressed and focused, ScrollView re-sizes itself and bottom View shows on the screen.

Test case

var tabGroup = Ti.UI.createTabGroup();

var tab1 = Ti.UI.createTab({
    title: 'Tab 1',
    window: Ti.UI.createWindow()
});

var tab2 = Ti.UI.createTab({
    title: 'Tab 2',
    window: Ti.UI.createWindow()
});

tabGroup.addTab(tab1);
tabGroup.addTab(tab2);


var scrollView = Ti.UI.createScrollView({
    width: '100%',
    height: '100%',
    backgroundColor: '#fc9',
    contentWidth: 'auto',
    contentHeight: 'auto'
});

var tf = Ti.UI.createTextField({
    top: 20,
    //focusable: false,
    width: 200
});

var bottomView = Ti.UI.createView({
    backgroundColor: '#f00',
    height: '10%',
    bottom: 0
});

scrollView.add(tf);
scrollView.add(bottomView);

tab1.window.add(scrollView);

tabGroup.open();

Steps to reproduce the issue

Run the code provided above. You should see that bottom red View is not shown on the screen. Now, touch text field so it gains focus and you should see that View is now present on the screen, even when keyboard is lowered down. Also notice that View has different size when keyboard is present.

Expected behavior

Red View should be seen on the screen from beginning and focusing on TextField should not have affect on View's visibility or size. If ScrollView is replaced with basic View, this issue is not present (to see that, replace "createScrollView" with "createView" and set TextField's focusable property to false because first text field in a View automatically gets focused).

Comments

  1. Junaid Younus 2012-05-21

    Tested with 2.0.1GA2 on a Samsung Galaxy S2 (2.3.6), issue still exists.
  2. Shameer Jan 2013-02-25

    The issue can be reproduced with release 3.0.2 and latest master version 3.1.0 . Tested on: Titanium Studio, build: 2.1.2.201208301612 Titanium SDK version: 3.1.0 (25/02/2013) Titanium SDK version: 3.0.2 (25/02/2013) Device: Samsung galaxy s duos Android version: 4.0.4 The problem reproduced but i see that bottom red view is shown on the screen.When the TextField focused, it affects view's visibility and its size becomes reduced. If you set "focusable:true" then problem get solved.But in the case of "Button" and "Label" it works perfectly without "focusable" property ,So i think most probably its a bug.

JSON Source