Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting "Wrap Content" to a view programmatically

Is it possible to set Wrap Content Identifier int? Will the following code work?

EditText ET = new EditText(getActivity());
ET.setWidth(WRAP_CONTENT);
like image 628
user3784189 Avatar asked Oct 28 '25 20:10

user3784189


1 Answers

I suppose you should do something like that:

EditText editTextView = new EditText(getActivity());
LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,
        LayoutParams.FILL_PARENT);
editTextView.setLayoutParams(params);
like image 107
Access Denied Avatar answered Oct 30 '25 10:10

Access Denied



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!