tonguetech / Android-StickerView

Apache License 2.0
123 stars 41 forks source link

Load custom bitmap #1

Open taimur97 opened 8 years ago

taimur97 commented 8 years ago

When I load a bitmap it resizes it How can I load a resized sticker say like 150px by 180px? I tried changing the layout params from match_parent to different sizes but it didn't work and I also tried scalling the bitmap before loading it in StickerView but StickerView resizes it Please help...

kencheung4 commented 8 years ago

Hi taimur97,

You may use getMainView() to get the imageView in your stickerView and try to set the scale type of it. Default is fitXY. Maybe set it to fitCenter solve your problem.

taimur97 commented 8 years ago

I am trying to do it will it work if I change the layout params in StckerImageView file?

And after adding the text on screen when I resize it it resizes just like an image How can I change that behavior.. It should change the length but the height should remain half so it doesn't look like a square

kencheung4 commented 8 years ago

The layout params you mention in StickerImageView actually only affect how the imageView behave when the parent container (I.E the Framelayout) change it size. But if you want to make, say, a 150x180 photo to show on a square imageView, it's the scaleType that we should change. And I don't recommend you make change on the original file.

But for your second question, it may be a good request for the new feature, but to solve your problem fast, you can consider change not to use "AutoResizeTextView" in the StickerTextView class. AutoResizeTextView make the text behave like image, when you resize your container, the text will also become larger. So changing from AutoResizeTextView to normal TextView can make your container larger but the text size remain unchanged.

Hope it helps :)

taimur97 commented 8 years ago

I have solved the image issue but the text issue is still present. I tried changing from AutoresizeTextView to simple Textview but it didn't help. One way to solve it is if we change ratio at which the height of the text is resized. If it resizes half the length of width when size is changed the problem will be solved. I tried to do it but didn’t understand much how the code was working Can you please try to implement it and see if it works?

cnkcheung3 commented 8 years ago

Hi taimur97,

I am sorry that currently it would always be a square border but changing to normal textview can help to show all the text in a single line instead of resizing the text.

I appreciate if you can push a new feature branch regarding your issue, thanks a lot.