TextView textView = new TextView(getActivity());
textView.setBackgroundResource(R.drawable.shape_item_talker_realm);
textView.setText(skill.skill_name);
textView.setTextSize(12);
textView.setPadding(12, 12, 12, 12);
textView.setTextColor(ContextCompat.getColor(getContext(), R.color.userIndexTagText));
ViewGroup.MarginLayoutParams lp = new ViewGroup.MarginLayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT
);
lp.setMargins(0, 0, 15, 15);
I want to add MarginLayoutParams
to my view. But, It shows an error
should pass resolved pixel dimension instead of resource id here:
getResource().getDimession*(ViewGroup.LayoutParams.WRAP_CONTENT)
How can I solve this problem?
MATCH_PARENT
and WRAP_CONTENT
are indeed valid input for LayoutParams
width and height.
This is hyperactive Lint in action. You can safely ignore the warning.
Select the underlined statement, press Alt+Enter, select the issue, select Ignore for statement/for method.
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