Android reverse curve corner drawable/canvas - android

Is that possible to create different corner for drawable (or draw over the canvas whatever) like this in Android?
demo picture
My goals is to become tab layout indicator to look like that picture, I can make tab layout indicator to be a full width by setting tabIndicatorGravity to stretch.
But I have no idea to complete such as corner and left/top/right margin (look at the pic).
** Edit **
Some icon from the demo picture (like spinner) isn't my point.

Related

rectangle layout with a small triangle arrow attached to its side

I am building an Android app and trying to create a list item view for my RecyclerView, that will look like the one in the picture.
I successfully created the view (using 3 RelativeLayouts side by side inside a LinearLayout) but without the triangle arrow.
Can someone please advise on how to reach the desired result with the triangle arrow in an xml drawable?
Please note that the rectangles should have same x coordinates and only the arrow needs to "invade" to the adjacent layout area.
you can add images with the desired color with attribute center vertical to true, you can find the icons on https://material.io/icons/

How do I create a layout w/ a white background, grey border with a triangle arrow - Android

How would I replicate this in Android, my general instinct would be to create a regular layout w/ a border, then have 2 layouts that contain a triangle (one the same color as the border + one that's slightly smaller but white and overlap the two), idk if there's an easier way to do that:
You can use 9patch to achieve something like you wanted.
The Draw 9-patch tool is a WYSIWYG editor that allows you to create
bitmap images that automatically resize to accommodate the contents of
the view and the size of the screen. Selected parts of the image are
scaled horizontally or vertically based indicators drawn within the
image.
A complete guideline can be found here : http://developer.android.com/tools/help/draw9patch.html
The easiest way to reach this, is to set the layout background to that image.
background="#drawable/template"
Probably you want to have the area out of the "bubble" transparent, so you will need to save it as PNG.

Android - Curve on Top Left Corner in Image

I have a 4 sharp cornered image to display it my android application. But i want that image to be little curved from Top Left Corner. There should be no animation, nothing. Just an Image with a Curve on its top left corner.
Please look into the following image for reference, for what i wanted to achieved.
take a linear layout with fill parent and set background color while. then use image with in linear layout to show another one image on the screen.

Android: how to use the 9patch creator?

I am trying to create a stretchable scroll handle for my app.
The first image is the scrollhandle.9.png that I include in my app's resources.
The second image shows what this 9patch image looks like when used in my app.
Any advice on how to accomplish a stretchable scroll handle?
Edit: With help from posters, I was able to get an image that works. I added it below to help those who may find this in the future.
The area covered by the top and the left black line(dots) will be used while scaling your image. This area will be highlighted to you when you click the "show patch" option. You can see how the image scales by using the "Patch scale" option given in the draw9patch tool.
The area covered by the right and bottom lines(dots) will hold the content for the background.
Eg: You can define boundaries for the text inside 9 patch image for editor background. For your case you don't need right and bottom lines.
So for your case place two dots at the top corner and two dots at the left corner. Make sure patches doesn't fall in the arrow image of the scroll(if they do fall your arrow image will also get stretched) . Try putting the dots only in the left and top lines till you get the desired preview with "Patch scale" option.
If you use only one dot (instead of four) at the top and bottom left, and one at image top center, it should stretch the way you want it to.

Custom Map markers and custom backgrounds

I am trying to get the images to have transparent backgrounds so the map is not blocked by a square marker with an image in it. What image editor and what settings should I use to get this to work?
I am trying to do some custom backgrounds for buttons and the same problem comes up: I get square corners and a background that does not scale with the buttons.
I think this all part of the same problem: I am not using the right tool with the right settings to create the images. I must be misinterpreting the documentation and examples that talk about a white border around the image and a black line along the top and left side for the expandable button background.
Here's a quick way to reproduce the problem:
Follow the directions to create the MapView program as described on:
http://developer.android.com/resources/tutorials/views/hello-mapview.html
For the icon I first used the image copied from the page:
Next I edited the picture in Microsoft Paint, and cut off the little guy's antennae. I'm not cruel and no real androids were harmed in that experiment. I surrounded the new picture with a pixel thick border of white, copied from the border that was around the rest of the image, and then copied the black that was there as well in the void areas of the image, outside the border.
I saved the image as myandroid.png and copied the file to the layout folder. Pointed the activity to the new pic and ran the program.
The image was displayed with a full square background and shadow, not the android shaped image and shadow that was there when the original image was used.
Custom Button background:
Follow the directions for the Relative Layout example at:
"http://developer.android.com/resources/tutorials/views/hello-relativelayout.html"
Next, I created an image to expand as a background for the button called backbutton.png. It too is surrounded by a white border and black filled on the corners, the top and one side per documentation I found in "Android Programming Tutorials" on page 298.
The background does not expand, nor do the corners round.
I wish I could show you screenies of what I have.
How do you create the images for the custom backgrounds and the images for the custom map markers and buttons? I need to know what image editor to use and the file attributes to set, so the images expand and display with the proper void spaces in them.
Thank you in advance.
You used MSPaint to save the image did you define the transparent color?
should in Image > Attributes
To create custom backgrounds for buttons and other widgets that can change their size at runtime, you should create NinePatch images. The tool you should use is draw9patch and is available with the Android SDK.

Categories

Resources