[TIMOB-19869] Android: Support adding native UI elements to Ti.UI.View subclasses
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2015-11-05T20:59:57.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 5.4.0 |
| Components | Android, Hyperloop |
| Labels | n/a |
| Reporter | Christopher Williams |
| Assignee | Christopher Williams |
| Created | 2015-11-04T19:04:23.000+0000 |
| Updated | 2016-07-22T01:06:11.000+0000 |
Description
Be able to pass in some subclass of android.view.View into Titanium methods that take Ti.UI.View subclasses (i.e. Ti.Ui.View.add())
var FrameLayout = require('android.widget.FrameLayout'), LayoutParams = require('android.widget.FrameLayout.LayoutParams'), ViewGroupLayoutParams = require('android.view.ViewGroup.LayoutParams'), Gravity = require('android.view.Gravity'), Activity = require('android.app.Activity'), activity = new Activity(Ti.Android.currentActivity), main, win = Ti.UI.createWindow(), view = Ti.UI.createView(); // Create a native layout to add our boxes to main = new FrameLayout(activity); main.setLayoutParams(new LayoutParams(ViewGroupLayoutParams.MATCH_PARENT, ViewGroupLayoutParams.MATCH_PARENT, Gravity.TOP)); // Add our layout to the Ti.UI.View view.add(main); win.add(view);[~cwilliams], When I use the code above I get error :
[ERROR] : TiExceptionHandler: (main) [98,98] ----- Titanium Javascript Runtime Error ----- [ERROR] : TiExceptionHandler: (main) [0,98] - In ti:/module.js:280,9 [ERROR] : TiExceptionHandler: (main) [0,98] - Message: Uncaught Error: Requested module not found: android.widget.FrameLayout [ERROR] : TiExceptionHandler: (main) [0,98] - Source: throw new Error("Requested module not found: " + request);Verified the implementation. Closing. Environment: Appc Studio : 4.7.0.201607111053 Ti SDK : 5.4.0.v20160720201924 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.5 Appc NPM : 4.2.8-1 Appc CLI : 5.4.0-33 Node: 4.4.4 Nexus 5 - Android 6.0.1