May 5 | 8:25 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
May 5 | 9:05 AM |
sudokai | has entered the room |
May 5 | 9:10 AM |
Mark M. |
hello, sudokai!
|
sudokai |
Hi Mark
|
Mark M. |
how can I help you today?
|
sudokai |
Do you know any way I can crop the top or bottom of an image?
|
sudokai |
ImageView only has the "centerCrop" option
|
Mark M. |
off the top of my head, I don't, unless the image is a Bitmap
|
Mark M. |
for a Bitmap, you can always transform it using a Matrix or something
|
sudokai |
Android UI is pretty hard. I just spend the entire morning trying to apply border radius to a ImageView on one side of the image only
|
Mark M. |
I'd phrase it more as "easy things in Android UI are not too bad, but there are only so many easy things in Android UI" :-)
|
sudokai |
I ended up doing this and it seems to work
|
sudokai |
View paste
(8 more lines)
|
May 5 | 9:15 AM |
Mark M. |
it has a been a long time since I used attributes like android:bottom="10dp" (assuming that I ever have...)
|
sudokai |
Then setting this as the imageview background and enabling clipToOutline
|
Mark M. |
other than the lack of RTL support, though, what you have there seems reasonable
|
sudokai |
Of course, there's a bug since who knows when, and clipToOutline cannot be used in xml because of that, so you need to do it in Kotlin/Java
|
sudokai |
I guess I'm just venting...
|
Mark M. |
yeah, I feel like pointing out that none of this is my fault, AFAIK :-)
|
sudokai |
How come everything is so badly designed?
|
sudokai |
Like the 3 classes for Fragment, this sort of stuff...
|
Mark M. |
partly, I'd phrase it more as "organically designed", as there has been a lot of cruft from 12+ years of development
|
Mark M. |
partly, thanks to backwards compatibility concerns, some early hardware limitations continue to limit our framework APIs, even when the hardware itself is better
|
Mark M. |
so, for example, the three fragments are a bit of both of those things
|
May 5 | 9:20 AM |
Mark M. |
fragments didn't exist in API Level 1 and were introduced in API Level 11, so they weren't designed into the framework at the outset
|
sudokai |
View paste
|
Mark M. |
no, unless you render that vector to a Bitmap first
|
sudokai |
About about the shape xml I showed before, it took me a lot of googling to find it but I still don't fully understand it
|
sudokai |
There's <corners android:radius="10dp" /> to get rounded corners on 4 sides
|
sudokai |
That part is clear
|
sudokai |
But then
|
sudokai | |
sudokai |
Actually turns the top left rounded corner into a square
|
sudokai | |
sudokai |
It turns the top right corner into a square one
|
Mark M. |
it's more that you are defining three layers (<layer-list>)
|
Mark M. |
later items in the XML are higher on the Z axis
|
Mark M. |
and you don't have <corners android:radius="10dp" /> on those latter two items
|
May 5 | 9:25 AM |
Mark M. |
so they will be square, and since they are higher on the Z axis, they will overlap your rounded corners from the bottom layer
|
sudokai |
Yeah, that part I understood, it's like putting layers on top
|
sudokai |
My question is really how android:bottom works?
|
Mark M. |
like I said, if I have ever used that, it's been years and years
|
Mark M. |
so, off the top of my head, I can't answer that, sorry
|
sudokai |
I've just been playing with it, I think I finally undrstand
|
sudokai |
It's like CSS and position: absolute
|
sudokai |
You place the layer on top as you said and just move it enough to uncover the rounded corners below
|
Mark M. |
OK
|
sudokai |
That's why bottom right actually covers top left
|
Mark M. |
ah, I see
|
May 5 | 9:30 AM |
Mark M. |
anyway, that's a wrap for today's chat
|
sudokai |
Thanks!
|
Mark M. |
the next one is Thursday at 7:30pm US Eastern
|
sudokai |
See you around
|
Mark M. |
have a pleasant day, and stay healthy!
|
sudokai | has left the room |
Mark M. | turned off guest access |