The problem is that these semicircles should change position depending on the content.
https://i.imgur.com/3DT6qFF.png
I have tried to do this using two CardView, but it was no what I want
Make a drawable png file by photoshop or any other image editing tool and use that in the background instead of cardview.
Hope it will help you to achieve your goal.
Thank you
Related
I'd like to 9patch this image, but I can't seem to
I've tried understanding the things mentioned here https://software.intel.com/en-us/xdk/articles/android-splash-screens-using-nine-patch-png but I can't seem to apply them to my image
Any ideas? And yes, it doesn't help that the icon is rounded ...
According to the linked page you "draw lines that define the stretchable patches.". In your case, the stretchable part seems to be left of the logo until the left half-circle starts.
I added an image with an oversized stretch-line to mark the horizontally stretchable part.
There is no way, to use your image only with 9 path. Best practices for your task - using several images with 9 path. Maybe creating custom view.
1) As you can see, first image, parent with blue color, should include 9 path (it's easy to make without internal image).
2) For best looking in any device you need to create another thing for second image (with facebook char). 9 path for circle - not best idea. So I advice you use holder, with xml canvas background and char "f" in foreground.
3) Now you need to put this all in one FrameLayout, which you will use anywhere. All structure will be as example below:
<FrameLayout> // You may create custom view instead of FrameLayout
// for more flexible and understanding
<BlueImageBackground.9path
gravity=center>
</BlueImageBackground.9path>
<WhiteImageFacebokChar
gravity= center_vertical | left>
</WhiteImageFacebokChar>
</ FrameLayout>
As a result, in any screen, this image will appear identically...
The source image you provided should be edited first, my version:
in sdk/tools folder there is draw9patch tool, so you can use it to edit it. You would see something like this:
Hi it is preferable to create an empty 9 patch image "without the logo" and then setting it as the background of a relative layout and then add an image view to the relative layout and add to the ImageView:
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
Moreover you have to adjust the margin of the image view to achieve the desired result.
Note that this method will not stretch the icon & it requires some fine tuning to the image size and padding to achieve the desired results :-)
I want to apply shadow at bootom of ImageView as shown in image below.
Any trick to achieve that in android ??
The easiest way that I have seen to do this is to create an image that is just a drop shadow and then set that as the background for the container of your image.
Here is a really great SO thread about how to do just that.
No ,you have to create a image which have shadow as well as border.
so ,after that you have to set padding to your image so it's look like this frame.
How can I create a border (gradient from #color1 to transparent) around the activity using XML styles? Please see the image below.
With plain XML this is not possible (as far as I know). But you can use the 9-patch images in order to do this. Just create one with the Draw-9-patch tool from the sdk.
You can do it with and tags as special drawables.
Take a look at this example.
I am having the following requirement.
1> I have a background image(png) (containing various shades) of color with stripes.
Is there any class which is already available on Android using which I can convert the image to Color object & set on the layout as background color?
Will the ColorMatrix class help ? I want to avoid using the image as background , as with different screen resolutions , even after having separate drawable folders , there can be cases when the background image can get stretched , giving a wrong view .
Kindly provide your inputs/sample code. If my approach is incorrect , kindly provide the correct logic.
Thanks in advance.
Warm Regards,
CB
This is a confusing question...what kind of background image is this? If it's just a gradient, you can create one using ShaderFactory programmatically. And if it's something that doesn't have a lot of fine detail, you can just use a single image, and just have it scale to fit the screen. Rather than using the android:background attribute, a trick you can use is to wrap your layout in a FrameLayout, and add an ImageView behind the rest of your layout, with the background set as your ImageView's source. Set the scaleType to something like centerCrop, and it will scale proportionally.
Can you give an example image?
I have a transparent listview with a image as background. Now, i want the scrollbar as transparent too, i.e I must be able to see the background image through this scrollbar too. Pls help!!!
Try this:
android:scrollbarThumbHorizontal="..."
android:scrollbarThumbVertical="..."
Where ... is a reference to your transparent drawable.
In your XML, if you add the line
android:scrollbars="none"
your ListView will still scroll, but have no visible scrollbars.
Check out the answer to this post:
scrollBar in a listView...customizing it.
They describe how to create a customized scrollbar with a given image. Your solution would be to create an image with some alpha value as to make it as transparent or as opaque as you want.
Oh yeah, make sure your image is a .PNG file as jpegs do not contain alpha information, so the cannot do transparency.