Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19870] Android: Support adding Ti.UI.Views to native view groups

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2016-05-10T19:47:25.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid, Hyperloop
Labelsn/a
ReporterChristopher Williams
AssigneeChristopher Williams
Created2015-11-04T19:05:43.000+0000
Updated2017-03-20T21:37:06.000+0000

Description

Comments

  1. Christopher Williams 2016-05-10

    Looks like this is already supported. I tried replacing the app/android/alert.js controller contents with:
       (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);
       
    And it just seemed to magically work.
  2. Lee Morris 2017-03-20

    Closing ticket as invalid.

JSON Source