How to create button with blurred drop shadow in Android Studio - android

I know this question is a duplicate, but I have not found the answer. So, is it possible to create a barely visible blurred shadow from a button in Android Studio? I found an example of a button with the shadow I need. How to make such a shadow so that it is adaptable to each size of the button? Thx.

you have few ways to achieve this. easiest would be to create 9-patch from an image, read carefully how to in official DOC. most pro would be to write own blurring code with probably most efficient for this purpose RenderScript. IN HERE you can find useful article how to blur images with this tool
you can always implement common material-design-styled Button using elevation/translationZ for increasing size of rendered-by-default shadow, but afaik there is no option for changing its color...

Related

Android 9-patch image usage

OK, I've read a lot of tutorials and even downloaded some examples, but for the love of Stackoverflow, I can't get my image to stretch like I want it to and I'm hoping that someone can help me out here.
I create an image that is to be the background of a button object in Android. Here is the image:
Now, I'd like for it to stretch to the desire size of the button, whether the button is 50x50dp or 200x100dp. One thing I don't want is the border to stretch as it will look distorted, so I want to specify not to include the border, but stretch everything else to the desired size of the button.
Can someone please show me where the black lines need to go in order to achieve my goal? Do I have to change my original image in order to achieve my goal?
Thank you in advanced.
David
It's very simple using this tool Android Asset Studio: Simple 9-Path Generator. Although no matter how you do it you will have stretching and distortion due to the textured (non-patterned) background. I would stay away from that style both personally and for usability.

Draw specific shadow in Android

I'm looking for way how to implement specific shadow (like on picture) in my android app Android, with using xml (I can't use 9 patch for this).
This is white rectangle with the same shadow in all directions.
Any idea?
As far as I know, there's no way to create a shadow efficiently with XML without using 9-patch image. You can try playing with shapes and gradients, but the result won't look good.
I also did some tests by adding several shapes with transparent borders, but again the result is not good.
Can you explain your situation (why can't you use 9-patch, which is well supported by android).

Adding transparent rounded corners to google map

So I'm designing an app that uses google aps api, and I want the map to look better by rounding the corners. I found a bunch of tutorials already but all of them only work if the activity background is a solid color, for example black.
However, my application has a multi-color background. Is there a way to make those corners rounded, but transparent so that it doesn't block my background?
Well I guess you have stumbled on this question I asked regarding the same topic:
Is there a way to implement rounded corners to a Mapfragment?
But in this case I needed a solid color corners. I don't see an easy way to perform what you
ask for. There is no way to added rounded corners to the map "out of the box" so you will need to cover those corners with some other texture, typically it would be a 9-patch texture, that could stretch accordingly to the screen size.
You can take a look at this blog post on 9-patchs I wrote and maybe try to create a
semi-transparent texture that will fit you needs:
9-Patch guide
I've spent few days trying to figure it out, it also seems like it is not possible to use MapView separately, so this seems to be impossible which really sucks. I've also tried to extend MapView and override onDraw in order to apply it to another class which would extend MapFragment, but it is all seems to be waste of time. Maps layouts really suck in Android...

How to achieve glossy look in android

One of the applications in my mobile has this glossy and transparent look(refer the snapshot below), which is quite beautiful. Just want to know how I can achieve this.
I am developing an application for myself and want to implement similar kind of GUI. Although I can create a layout, I am still not good in creating beautiful icons like the one shown above. Any information (or) a link to icon development related tutorials should also be quite helpful. Thanks everyone in advance.
Those are just PNG images with transparency and glossy effect... it almost has nothing to do with programming. Just find a good designer and tell him/her to do a 9patch image like that.
By the way... background buttons, in that case should have the border only. The icon and text can be then added easily.
You have to combine multiple techniques. You can use Button where the background will be defined with a nine-patch image, with rounded corners. Then you can use android:drawableLeft parameter of the Button, to define the icon it will have.
As also Cristian suggests, this is not hard to implement. You need a good designer and get to know the basic techniques like 9patch png images, transparency and basic layout definitions. Good luck

Creating a 9 Patch with repeatining pattern

iam stuck with the creation of a nine patch for a progressbar background.
It has a repeating pattern like a ruler-scala and that given me headache.
here is a image of what i want(at the bottom) and what i have (top).
can someone give me a hint how to acomplish my goal?
edit: or is it generelly possible to do this with a 9patch?
my other attempt was to make a with android:tileMode="repeat" but there i get problems with the height of my image (repeating in the second line), i need something like repeat-x.
Thanks in advance
edit2: ok i managed to do my repeating 9patch by stretching the whole repeating pattern, but its not ideal :(
You seem to be overestimating the power of 9-patches. The most you could do is have a ruler image with expanding space between the ticks. You can't, however, make a 9-patch that automatically tiles parts of your image.
On the other hand, if you create a BitmapDrawable programatically, you can set the tile mode separately for the X and Y axes.
I used to do this in my webview project using border image which provides both options (repeat, stretch, fill).
As webview has kind of it's own problems in android (mostly fixed element) I decided to be more android for the next project and I found out that it's not possible to have the repeated border using 9Patch. It's so awkward as it's needy but not implemented.
In a word android development area makes me crazy, one option here one option there is a usual thing here.

Categories

Resources