I have a parent custom layout (child of LinearLayout) that I inflate programmatically.
In the constructor I add another layout to be a child of my parent layout like this:
public ExtendedContentLinearLayout(Context context) {
super(context);
this.context = context;
this.setClickable(false);
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mTrigger = inflater.inflate(R.layout.nav_menu_board_expandable_children_outer, this, true);
mTrigger.setOnClickListener(this);
mTrigger.setBackgroundResource(R.color.da_blue);
}
The parent layout and the "trigger" layout (The child just added above) are working and shown fine.
Once the user touches this "trigger" layout, I want to add a new child to the parent - another layout with more content and thus I need to parent layout to expand and include the newly added layout but this is not working!
Clicking the trigger layout doesn't add a new layout (At least not shown on screen). This is the click call (the click event is working):
@Override
public void onClick(View v) {
App.disableTouchEventForDefaultDuration();
Log.d("CLICKED", "CLICKED");
LinearLayout mContent = new LinearLayout(context);
mContent.setOrientation(HORIZONTAL);
mContent.setBackgroundResource(R.color.da_indicator_pink);
mContent.setVisibility(VISIBLE);
ExtendedContentLinearLayout.this.addView(mContent);
}