I was wondering if there is a difference between
LinearLayout.LayoutParams separatorParams = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
TextView separator = new TextView(context);
separator.setLayoutParams(seperatorParams);
this.addView(separator);
Or
LinearLayout.LayoutParams separatorParams = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
TextView separator = new TextView(context);
this.addView(separator,separatorParams);
According to the source code, it basically makes no difference since addView(View view) calls addView(view, view.getLayoutParams())
Absolutely none.
this.addView(separator);
Will grab the params from the child or generate it.
Where as: this.addView(separator,separatorParams);
Will use the params then add it to the layout anyway.
Have a look at the source here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With