Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25333] Android: SearchBar height should default to Ti.UI.SIZE like iOS instead of FILL

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionUnresolved
Affected Version/sRelease 6.0.0
Fix Version/sRelease 9.3.0
ComponentsAndroid
LabelsSearchBar, android, engSchedule, parity
ReporterJoshua Quick
AssigneeGary Mathews
Created2017-09-22T17:58:34.000+0000
Updated2020-11-20T00:24:54.000+0000

Description

*Summary:* The "SearchBar" height on Android defaults to Ti.UI.FILL, but iOS defaults to Ti.UI.SIZE. The default on Android should be changed to match iOS' behavior for parity. Also, setting the height explicitly to Ti.UI.SIZE on Android does not work at all and it still does a FILL instead. *Test Code:*
var window = Ti.UI.createWindow(
{
	layout: "vertical",
	fullscreen: true,
});
window.add(Ti.UI.createSearchBar(
{
	showCancel: true,
	barColor: "#008800",
	width: Ti.UI.FILL,
//	height: Ti.UI.SIZE,
}));
window.add(Ti.UI.createLabel(
{
	text: "Search Bar Test",
	height: Ti.UI.FILL,
}));
window.open();
*Alternative Solution:* Instead of fixing the Java "TiUISearchBar.java" code's height issue, we could instead replace Titanium's custom search bar implementation to use Android's native "SearchView" feature as suggested by [TIMOB-16886]. Titanium's "Ti.UI.Android.SearchView" feature does not have this height issue and is native. So, the idea is to keep the "SearchBarProxy.java" but have it map to SearchView instead. However, this may be a breaking change and perhaps should only be done in a major rev of Titanium.

Attachments

FileDateSize
android-bad.png2017-09-22T18:01:06.000+000026058
ios-good.png2017-09-22T18:01:06.000+000037371

Comments

  1. Joshua Quick 2020-11-04

    I've confirmed that the following PR resolves this issue... https://github.com/appcelerator/titanium_mobile/pull/12029

JSON Source