Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add view at runtime #27

Open
johnpilll opened this issue Mar 3, 2016 · 3 comments
Open

Add view at runtime #27

johnpilll opened this issue Mar 3, 2016 · 3 comments
Assignees

Comments

@johnpilll
Copy link

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);

@jekiapp
Copy link

jekiapp commented Jun 12, 2016

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);

@aliusa
Copy link

aliusa commented Jul 2, 2016

How do you set OnClick for each item?

@jekiapp
Copy link

jekiapp commented Jul 4, 2016

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants