pI am working with a linear layout and want to set the maximum height of the view. Under "normal" circumstances, I want the view to use "wrap_content." However, occasionally the circumstances may push the layout to an undesirable size. When this happens, I want to limit the height to a maximum 300dp.
I have set the size of the view using the following when the list in the layout exceeds 4 list items:
LinearLayout listLayout = (LinearLayout) dialog.findViewById(R.id.listLayout);
if(list.size() > 4){
LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 300);
listLayout.setLayoutParams(params);
}
Reviewing the documentation leaves me with no clue as to the unit of measure that is applied. What are the units of measure in this situation (dp, sp, px, ...)?
Running tests, even setting the value to 100 has the list exceeding desired height.
Please advise