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/
Related
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.
Maybe some kind of simple question to those who are skilled at android layouts, but what is the best approach to draw smth like this (maybe what widget to use) for positioning rounded area which spreads out of top border of dialogFragment and is horizontally centered like this:
You will have to create a custom layout for Dialogs.
In this case, you have all the control you want for defining dialogs layout, same as for any view.
If heart icon is all you have, create an xml for white circle and use it as a background for the heart, set it to top of parent, center it horizontally.
As you will have exact height of circle, you can set half of it as top margin for the rest of the layout below to make circle look like a hump (as on screenshot).
You can use a 9 patch as the background of you dialog. Define the stretch areas and the content area and you should be good :
And for exemple use this 9 patch file:
I want to generate the following for my Android application.
I tried to achieve this using RelativeLayout and some drawables (empty circle, filled circle, dotted line) I created using XML , but I am not even close to it. Is it the right way to generate such views with layouts. If so, is RelativeLayout is the way to go? Or should I create a custom view for that?
why are there 4 dots between the last item and the one before it, while the other have 3 dots?
anyway, i think you can achieve those results by having a listView with custom items.
each item would be shown as a relativeLayout with 2 imageViews (one below the other) and a textView on the right of the upper one.
the upper imageView would have the large dot (filled or not), with optional dots above it, and the imageView below would stretch its size according to the textView (align to its bottom plus add some more for extra small-dots) and have tiled dots as its background.
another approach would be to have a listView of textViews and an imageView on its left, and you draw the circles according to what the listView is currently showing (even while scrolling). it's much harder, but might be more precise.
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.
I need to make tabbar of the following desigh:
Its active item overlaps adjacent items.
My problem is that I don't know how to make different tabs overlap each other (as far as I know, it isn't possible to change z-order of views programmatically). How to do it?
P.S. By the way, that is not necessary for me to use particularly tabbar. That can be, for example, 3 buttons in horizontal linear layout or any other combination of views which allows to make tabbar functionality.
I made this one by creating 3 buttons with rounded angles, big container with rounded angles (only top of it is displayed on my image) and linear layout behing above mentioned views, which fills space between bottom angles of any 2 adjacent buttons.
This linear layout consists of 4 parts which change its background color to appropriate one dynamically in buttons' onclicklistener (same for 3 buttons).
Shadows are implemented via gradient of black (with different alpha) in button's background drawables (which are layer-list with 3 shape items - background shape, padded shadow shape and again padded background shape).