Reputation: 45991
I'm developing an Android 3.1 tablet application and I have a "problem" with EditText control.
This is an EditText without text:
But, when I type some text on it:
Those four rows were created programmatically:
LinearLayout layout = null;
LayoutParams layoutParams = null;
EditText editText = null;
RadioGroup rGroup = null;
RadioButton rButton = null;
String tag = null;
layout = new LinearLayout(mActivity);
layoutParams =
new LayoutParams(LayoutParams.FILL_PARENT, 60);
layout.setOrientation(LinearLayout.HORIZONTAL);
layout.setLayoutParams(layoutParams);
editText = new EditText(mActivity);
tag = Long.toString(eOtherChks.getEreportOthChkId()) + "_" + OTHER_DESCRIPTION_COL;
editText.setTag(tag);
layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
layoutParams.weight = .25f;
editText.setLayoutParams(layoutParams);
editText.setGravity(Gravity.CENTER);
editText.setText(eOtherChks.getDescription());
layout.addView(editText);
But, in another view, I have added some EditText programmatically with editText.setInputType(InputType.TYPE_CLASS_NUMBER);
and they don't get bigger.
How can I avoid this effect?
Upvotes: 2
Views: 329
Reputation: 45991
This is how I've solved the problem:
layoutParams = new LayoutParams(0, LayoutParams.WRAP_CONTENT);
Upvotes: 0
Reputation: 358
You can try setting:
layoutParams.width = 0;
This should prevent the resize. Let me know if it works.
Upvotes: 1