FlowLayout icon indicating copy to clipboard operation
FlowLayout copied to clipboard

Add view at runtime

Open johnpilll opened this issue 9 years ago • 3 comments

I am trying to add view at runtime, but it's not working properly.

TextView textView = new TextView(context); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); textView.setBackgroundColor(Color.GRAY); textView.setText("New Item"); flowLayout.addView(textView,layoutParams);

johnpilll avatar Mar 03 '16 13:03 johnpilll

I solved mine, give it a try : TextView textView = new TextView(context); FlowLayout.LayoutParams layoutParams = new FlowLayout.LayoutParams(FlowLayout.LayoutParams.WRAP_CONTENT, FlowLayout.LayoutParams.WRAP_CONTENT); textView.setBackgroundColor(Color.GRAY); textView.setText("New Item"); textView.setLayoutParams(layoutParams); flowLayout.addView(textView);

jekiapp avatar Jun 12 '16 22:06 jekiapp

How do you set OnClick for each item?

aliusa avatar Jul 02 '16 20:07 aliusa

in my case I just set each textView onclick listener, simple.

jekiapp avatar Jul 04 '16 03:07 jekiapp