A
A
Anton Peat2014-10-25 17:25:00
Java
Anton Peat, 2014-10-25 17:25:00

How to extend ImageView via java?

It is necessary to change the parameter for the image by the checkbox:
android:layout_width="wrap_content"
to
android:layout_width="fill_content"
and back.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kanaev, 2014-10-26
@id_aspin

As far as I know, there is no parameter for width and height called fill_content.
I will think that this is a typo and you need fill_parent.
Then this line of code can solve your problem:

//сделать по ширине родителя:
imageView1.getLayoutParams().width = LayoutParams.FILL_PARENT;

or
//сделать по ширине контента
imageView1.getLayoutParams().width = LayoutParams.WRAP_CONTENT;

It is desirable to use MATCH_PARENT instead of FILL_PARENT.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question