[TIMOB-19870] Android: Support adding Ti.UI.Views to native view groups
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | High |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2016-05-10T19:47:25.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Android, Hyperloop |
| Labels | n/a |
| Reporter | Christopher Williams |
| Assignee | Christopher Williams |
| Created | 2015-11-04T19:05:43.000+0000 |
| Updated | 2017-03-20T21:37:06.000+0000 |
Looks like this is already supported. I tried replacing the app/android/alert.js controller contents with:
And it just seemed to magically work.(function (container) { var FrameLayout = require('android.widget.FrameLayout'), LayoutParams = FrameLayout.LayoutParams, Activity = require('android.app.Activity'), Gravity = require('android.view.Gravity'), View = require('android.view.View'), activity = new Activity(Ti.Android.currentActivity), view, main, layoutParams; // TODO Create a native view group (like RelativeLayout or FrameLayout) // Add a Ti.UI.Button or something to it // Create a native layout to add our boxes to main = new FrameLayout(activity); main.setLayoutParams(new LayoutParams(600, 600, Gravity.TOP)); // Make containing view large enough to hold box when animated // create a Ti.UI.View to add into the native group view = Ti.UI.createLabel({ color: '#900', font: { fontSize:48 }, shadowColor: '#aaa', shadowOffset: {x:5, y:5}, shadowRadius: 3, text: 'A simple label', textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER, top: 30, width: Ti.UI.SIZE, height: Ti.UI.SIZE }); main.addView(view); // add containing view to Ti view container.add(main); })($.alert_container);Closing ticket as invalid.