Feb 2 | 3:50 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Feb 2 | 3:55 PM |
Gabriele | has entered the room |
Gabriele |
hello
|
Mark M. |
hello, Gabriele!
|
Mark M. |
how can I help you today?
|
Gabriele |
how are you?
|
Mark M. |
OK, and you?
|
Feb 2 | 4:00 PM |
Gabriele |
I'm fine, too, thanks
|
Gabriele |
I have this ImageButton, but I can't resize it! I'd like to have it bigger, so I set width/height, I've also tried with minWidth/Height
|
Gabriele |
View paste
|
Gabriele |
View paste
|
Gabriele |
I change its size,but nothing happens
|
Mark M. |
so if you set android:layout_width="200dp" and android:layout_height="200dp", there is no change?
|
Gabriele |
exactly
|
Mark M. |
OK, what is the ImageButton inside, in terms of a container?
|
Gabriele |
View paste
|
Mark M. |
is your problem the size of the RelativeLayout, then? it is set to match_parent for height and width, so its size is controlled by whatever *it* is in
|
Gabriele |
I see the button with the same size, but its container seems bigger (more whitespace)
|
Gabriele | |
Mark M. |
try playing with android:scaleType, such as setting it to fitCenter
|
Feb 2 | 4:05 PM |
Mark M. |
or perhaps set it to centerInside (I can never remember the difference between those...)
|
Gabriele |
(I set it to wrap_content, should I change it?)
|
Gabriele |
eheh, ok
|
Gabriele |
ok, with fitCenter something changes (a bit bigger)
|
Mark M. |
you would need layout_width and layout_height set to your desired size as well
|
Gabriele |
so maybe fitCenter scale, while centerInside center it like it is
|
Mark M. |
you might also temporarily remove android:background="@null", so you see the full bounds of the ImageButton
|
Gabriele |
thanks
|
Gabriele | |
Gabriele |
View paste
|
Mark M. |
OK, so the problem is that the image is still not scaling right, but your overall button size is (presumably) what you want
|
Gabriele |
yes
|
Mark M. | |
Mark M. |
so, try android:adjustViewBounds="true", and see whether fitCenter or centerInside does what you want for the scaleType
|
Feb 2 | 4:10 PM |
Gabriele |
yes, thanks
|
Gabriele |
View paste
|
Mark M. |
did that give you what you wanted?
|
Gabriele | |
Gabriele |
it's still like that
|
Mark M. |
I guess not
|
Gabriele |
eheh
|
Mark M. |
try android:scaleType="centerInside", then
|
Mark M. |
BTW, with a null background, you might as well just use ImageView
|
Gabriele | |
Gabriele |
this is centerInside
|
Feb 2 | 4:15 PM |
Mark M. |
at this point, I don't really have any other suggestions, other than to try a plain ImageView and see what you get
|
Gabriele |
now trying with an ImageView
|
Gabriele | |
Gabriele |
View paste
|
Mark M. |
you may need android:scaleType there too
|
Mark M. |
BTW, are you sure this image is the one whose XML you posted? that XML has an intrinsic size of 96dp, which should be about half of your button size, but this appears much smaller than that
|
Gabriele |
yes
|
Gabriele |
what if I set it to 200 too?
|
Gabriele |
using scaleType do not change anything with ImageView
|
Feb 2 | 4:20 PM |
Mark M. |
you could try playing with the vector drawable content, I suppose
|
Mark M. |
but I'm running out of ideas
|
Gabriele |
eheh
|
Feb 2 | 4:25 PM |
Mark M. |
is there anything else that I can try to help with?
|
Gabriele |
no, thank you.
|
Feb 2 | 4:30 PM |
Gabriele |
I think the problem was android:viewportHeight vs android:height
|
Gabriele |
I created it again using vector asset with a bigger size, 96dp, it set android:viewportHeight="24.0", but it's working
|
Mark M. |
glad to hear you have it under control!
|
Gabriele |
and I'm still using android:scaleType="centerInside" android:adjustViewBounds="true"
|
Gabriele |
ahah, nice work with your kotlin book (even if I haven't read it yet)
|
Mark M. |
thanks!
|
Feb 2 | 5:00 PM |
Mark M. |
that's a wrap for today's chat
|
Mark M. |
the next chat is Tuesday at 9am US Easter
|
Mark M. |
er, US Eastern
|
Mark M. |
have a pleasant day!
|
Gabriele | has left the room |
Mark M. | turned off guest access |