How can some part of image be repeated - android

I'm android app beginner developer.
I made an 9-patch to use image like above.
Dotted line of image is not repeated only stretched.
I have to write text on the image like above.
How can some part of image be repeated ?
Please tell me some advice.

I dont think you can do that. 9-path image only stretches some part of the image. One solution could be is to use 3 drawables. One being the left arrow, one being the right arrow and one being the center image that is to be repeated. Then you can repeat the center image with dotted line as given here and here.

Related

Horizontal scrollview like shown in image

The screen should show the current image in the center and the next and previous images to its left and right in a smaller image size. You can see the image here On swipe, the images should change and select as new item. It would be helpful if someone could point me to existing code similar to this. I have tried Fancycoverflow. it gives this kind of effect, but it skips items when I try to set particular item in center. I am not able to scroll and set the image in center easily.
Here you can see something similar but not exactly. You can add round transformation, and bigger size that icon, which was clicked.
I tried to create a library for similar to your issue. You can custimize it for better suit. Here you can find the source code and a video that shows how it looks like.
See you.

Adding text on the border of Layout

I'm struggling with tricky issue here.
Basically I'm trying to locate text in the middle of the line surrounding linear layout, as per image:
click to see image (sorry, I only joined StOv and don't have enough reputation to post images directly)
One of the solutions I had in mind was to create background style for the layout with blue line offsetted from the edges (red border), and place on top of it (padding-ed accurately from the left edge) text with opaque background of the same colour as background (green border):
click to see image (sorry, I only joined StOv and don't have enough reputation to post images directly)
That should work, but solution itself seems to be bit provisional. Can you guys think of smoother, cleaner way of doing it?
Thanks
Try to create a background image as u need. Set it to background property of ur layout it will work

How do i align a button image with the size of the actual button?

I've been messing with android recently and i've gotten up to the point of changing the look of buttons. I've created an xml file in drawables for the state of the button and created an android:background="" line to refer to the xml. I've been searching for quite some time and it looks like no one else has asked the question.
This is what I get:
This is where the buttons are suppose to go:
How/Where would I set the size of the button image to match the actual button?
Also an additional sort of Off Topic question.
How do i make the image to only show the button and not the transparent parts of the image?
I think you can create 9-patch background image for your button.
Here is about 9-patch information: http://developer.android.com/tools/help/draw9patch.html
You can always use 9 patch images to make them stretch over the button. this link will help you create a 9 patch image

nine patch image doesn't work

I did a 9 patch image with android tool draw9patch.bat. Draw a black line only on the right side, where I want it to stretch. Saved as .9.png and set it to background of TextView:
android:background="#drawable/myninepatch"
It doesn't work, I get the image with the black line in the app and it doesn't stretch. What am I doing wrong?
I have seen at some places besides of the lines for the stretchable area there's also a very small marked area in the opposite side, but I don't know what is it for and I'm not using it.
Check this guideline . Here you can find simple UI Guideline for nine patch images .
In 9 patch images the right and bottom side lines indicate the padding, eg. the size which below the image won't shrink. The segment indicated by the top and left side line will stretch and shrink according to the desired size.

Draw a gradient filled polygon to use in a selector

I am trying to create a drawable such as this in Android:
I don't think a nine patch will work because there is nowhere that can safety scale vertically. So next I tried a shape drawable but it does not support triangles.
I want to render this image on the fly so there are no artifacts. Also I want to be able to use it in a selector, so I need to be able to represent this image in xml. Maybe I need to extend some class to manually make the shape. If so how do I embed a tag in the xml to tell it where to render? Does anyone know where to start with this or have an example of something similar?
I have read the first 10 pages of hits on stack overflow and google and am not getting anywhere. Thanks very much for any help.
I think a 9-patch would work. For the vertical stretching on the left boundary, fill in the line from top to bottom.

Categories

Resources