I have a different layout. Some of them are created using xml. Some others dynamically using code. When I'm in xml, I can set the width or height using the value "wrap_content". How to get the same result dynamically? This is a snippet of my dynamic TextView. I need to remove "final int width = 440;" and get the same value "wrap_content". How?
final int width = 440; final int height = textViewHeight; final int top = getNewTop(height); FrameLayout.LayoutParams layoutParams; layoutParams = getLayoutParams(width, height, top); TextView textView; textView = new TextView(_registerNewMealActivity); textView.setText(text); textView.setLayoutParams(layoutParams); _frameLayout.addView(textView);
source share