The blue rectangle in which test is written, how it is covering ,one full and some portion of lower and upper cell?, ,,, how these cells are made? , this isnt a simple grid. consider this ,what this layout contains, how blue rectangle can cover a specified area.?
help out
This is probably a custom view.
The background texture is a Bitmap , the cells are line drawn on a canvas and the blue area with text is a drawn rectangle.
When you create the view , you know oh many pixel represent an hour , so you should be able to give an exact position to the rectangle.
At least it's how i would do it.
You should have look at Creating Custom Views in android resources and more specificaly read Custom Drawing
To create such view you can:
create your custom view and draw on its canvas
use GridLayout that's available as a support library for android 2.1
I suggest to use the second variant.
Related
i want to make animated view as shown in the link
https://streamable.com/fpax52
there is an image selected and it should be rectangled and then animated with rgb
i have tried drawing canvas, but not sure that is proper way.
canvas?.drawBitmap(bitmap, 0f,0f,p)
it only drawes one image.
I also thought about creating multiple imageviews as rectangle but i think it is not good idea also.
I am currently working on an app where the UI is really important. So, I need to create a Button with a particular shape. I'd like to create one so my UI could look like this :
I saw several tutorials about creating your own drawables, but here my problem is the particular shape of my input. The "L" form bothers me ..
Any idea ?
I keep looking for a solution, and if I find one I will post it here as an answer.
You can either use an image of the shape you required or you can use 2 views places horizontally to each other. The first view will contain the yellow color as background with rect footstep image and another view with half of the height of first one having yellow background will be on the right of the first view.
P.S :
You can always use canvas to create your own views.
___________
|.....|.B....|B...|
| G.|____|.....|
|.....|........|.....|
|.....|.G__|.....|
You can't create a view like this BUT you can create a rectangle View like an ImagView that contains drawable like L. All you have to do is use VectorDrawables. create an SVG Image and then Convert it to a VectorDrawable by using Plugins like SVGVectorDrawable.
here is how to add plugin to your AndroidStudio
After All set the drawable to your Views Background.
I have image view with some lines and curves on it. I need to place the text labels into specific locations on this image. How it can be done?
In details:
Look at the image http://s9.postimg.org/63bq7ax4f/e7c5d09764c43a10537ea1b92a0c0c8b.png
I need "92 PAC" and "95 DRI" to be on that line as well as 2 lines below. Now it shifts upside or downside on different screen sizes.
P.S. If it can simplify the problem, the image can be only in one fixed size in one dpi bucket (despite it's incorrect from the android style).
Thank's
Make a custom view. In your onDraw function, draw that image as a bitmap, then draw the text exactly where you want.
I am trying to draw 3 lines real time, whose co-ordinates are constantly updating. In this link, How to draw a line in android, it is explained how to draw lines, but they take up all of the screen. How do I get it to take up only part of the screen, and let my layout main file take up the rest. Is this possible?
Thanks,
Rokky
If you wish to dynamically create the DrawView, as your example shows, 1cCreate a view (perhaps a FrameLayout) within your layout xml which will hold your canvas, and use standard Android layout techniques to make the FrameLayout be the right size.
Alternatively you can create the DrawView statically by placing it directly in your layout; How to add CustomView to Layout fromXML? shows how to do that.
hi,
I'm trying to implement something similar to the image attached. I have two textviews one on top of the other and i want their borders to look like the one in the image. I was able to draw rounded corners by setting the cornerradii of the GradientDrawable but i have no clue as in how to draw the slope on the right side of the first textview.
Any help on how to do this is much appreciated!!
thanks.
I would in this case do the graphics in a some graphics editing program (Photshop, GIMP or Inkscape for example). Two different drawings, one for the top part and one for the bottom. Then convert the drawings to NinePatchDrawable to be used as backgrounds for the text views. Since this type of drawable can be made larger or smaller depending on the length of the text in the TextViews.
You can use a transparent background image instead of drawing the background. Else you can use the canvas.
Edit : bad image example :-)