Android :: Offset Shape Within ShapeDrawable
Sep 9, 2010
I'm trying to draw a rounded rectangle with a border around it using a class that extends ShapeDrawable (see here) and everything is working except that the shapedrawable seems to be cutting off some of the border because the shape itself doesn't extend outside those bounds. Is there not some way to offset where the shapedrawable starts drawing so that there is some padding between the bounds of the shape itself and the canvas? I have tried both ShapeDrawable.setBounds to larger than the intrinsic size of the shape and ShapeDrawable.setPadding but don't seem to be getting anywhere. Should I be subclassing Drawable instead?
View 1 Replies
Jun 21, 2010
I want to have a elmenent with a 2 color border outline. I can do a single color outline using the element, but this only allows me to draw a single line. I tried using 2 elements within my but that didnt work either. Is there a way to either draw a shape within a shape or draw 2 lines around my shape (which has rounded corners btw).
View 3 Replies
View Related
Jun 22, 2009
I searched the groups to find a topic about setting horizontal scroll view's offset, but no results. Some topics talked about ScrollView, and they are not expected. Here is my question: I have a HorizontalScrollView, with LinearLayout as its child, the LinearLayout contains a custom view, I finished the onDraw method of the custom view to draw something which is longer than the screen's horizontal size, so I think HorizontalScrollView is the right widget that I need. But I do not want to display the left-most part of my custom view, such as a calendar, I can display the last week and next week in the custom view, but what I want to put in the center of the scroll view is today. So, I wonder how I should set the initial offset of the HorizontalScrollView?
View 2 Replies
View Related
Jul 16, 2010
I have two Image Views that are two football helmets facing each other. I'm wanting to center them and then offset them left/right a little to provide a little space between them. Here is one of the image view's xml at the moment.
CODE:...............
I was trying to offset it using [android:layout_marginLeft="25px"] however I'm guessing that's not working for me because of the [android:scaleType="centerInside"].
View 1 Replies
View Related
Feb 13, 2010
Is there a way to capture the audio using AudioRecord or any other API into a Direct ByteBuffer created using ByteBuffer.allocatedirect call with an offset?
From the documentation it is not clear that at which offset, calling the following method, will place the data: audiorecord.read(directbytebuffer, size);
View 2 Replies
View Related
Aug 1, 2010
I'm trying to update part of a VBO with a call to glBufferSubData(). When I update from the start (0) of my existing shadow buffer, there is no problem, as the buffer starts reading from 0. The following will read 0 to y from the buffer and place it at 0 to y in the VBO: gl.glBufferSubData(GL11.GL_ARRAY_BUFFER, 0, y, mPositionBuffer);
However, if I want to update a portion of the VBO (not from 0) I run into a problem; The following doesn't work, since it will write the values from the start of the buffer (0 to y) into position x to x+y of the VBO:........................
View 1 Replies
View Related
Oct 27, 2010
I am trying to parse an xml file using SAX with Android and the problem is that the function characters(...) is getting called multiple times with what appears to be the same data just offset by a few characters.
As you can tell from the output below the first time it gets called with " alabama" and the second time it gets called with "labama". I am not sure as to why it is doing this but if anyone could help that would be awesome.
10-27 23:04:47.033: DEBUG/LocationHandler(10299):
10-27 23:04:49.000: DEBUG/LocationHandler(10299): alabama
10-27 23:04:51.835: DEBUG/LocationHandler(10299): labama
10-27 23:04:52.129: DEBUG/LocationHandler(10299): labama
10-27 23:04:52.408: DEBUG/LocationHandler(10299): labama
10-27 23:04:52.519: DEBUG/LocationHandler(10299): ub_dir_name
10-27 23:04:52.649: DEBUG/LocationHandler(10299): ub_dir_name
10-27 23:04:52.809: DEBUG/LocationHandler(10299): ub_dir_name
10-27 23:04:52.989: DEBUG/LocationHandler(10299): ile_name.kml
10-27 23:04:53.158: DEBUG/LocationHandler(10299): ile_name.kml
10-27 23:04:53.358: DEBUG/LocationHandler(10299): le_name.kml
10-27 23:04:53.529: DEBUG/LocationHandler(10299): le_name.kml
10-27 23:04:53.698: DEBUG/LocationHandler(10299): le_name.kml
Code...
View 1 Replies
View Related
Mar 1, 2013
I have struggled to build successfully ICS Rom ( ASOP), but it's still not done. Now I have a error,
Installing update...
Random offset: 0x175
E:error in /sdcard/......
(status 0)
Installation aborted.
Update: I tried to wipe all and flashes again but it gave me another error: 0x188 or 0x133....
View 1 Replies
View Related
Jun 2, 2010
Just downloaded Shapewriter for My DInc. And it is awesome. All those waiting for Swype should give this a try because its pretty Incredible.
View 7 Replies
View Related
Oct 12, 2010
Anyone know where I can find this? I had it on my phone awhile ago but had to wipe and could not find it again in the market. IMO it was a tad bit better then Swype. Both great keyboards, I just liked that one better. If anyone could provide any info that would be great. Thank you.
View 2 Replies
View Related
Sep 15, 2010
How can I draw a shape (e.g. circle, rectange) that has different stroke and fill colors? Eg. A circle with green perimeter, but black inner fill.
View 3 Replies
View Related
Jan 27, 2010
Where is there information about the syntax of <shape> xml files. These can be used to define 2D graphics as I understand it. There are few spotty examples in the samples directory but that is all I have found.
View 7 Replies
View Related
Oct 20, 2010
Is there any way of defining a triangle in a shape item though a XML definition? It seems there is only rectangle, oval, line and ring. Why not a triangle?
View 4 Replies
View Related
Aug 22, 2010
I have a button on my app that I want to change the color of during different states of my application. However when I call btn.setBackgroundColor(Color.GREEN); the shape of the button changes. The rounded edges go away and I get a flat looking rectangle that is green. Is there a reason the shape is changing? Is there a a way to change the button color without the shape changing?
View 4 Replies
View Related
Oct 19, 2009
I would like to have a shape that has border only on 3 sides: top, left and right, i.e. I want bottom to be open. How can I achieve that defining shape in XML? Currently I have a normal 4 side border using the following shape XML definition:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" >
<solid android:color="#FFE8F0F8" />
<stroke android:width="1dp" android:color="#808480" />
<padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /> </shape>
View 5 Replies
View Related
Aug 14, 2009
I really appreciate if someone can help me with using how to use shape drawable as my background xml for my view. This is what I tried: But I never get the color. Android always gives me black text on white background, regardless what color attribute I put.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="1dip" android:color="#FBBB" />
<solid android:color="#6000"/>
</shape>.............................
View 1 Replies
View Related
Aug 11, 2010
I've created a custom toolbar using a gradient inside a shape. It looks very nice, but since we only have the option for 3 colors (startColor, centerColor, endColor) it looks very round. I would like to do a glass effect, which requires a sharp change in color in the middle. Basically I need 4 colors (startColor, justabovecenterColor, justbelowcenterColor, endColor). Now I could have two shapes sitting on top of each other to get this effect, but I don't want to do this. I'm getting into some tricky UI customization here and that would be very difficult to manage on different sized screens.
View 1 Replies
View Related
Oct 14, 2010
Instead of using in my layout ImageView and TextView I am now adding the image like this:
text.setCompoundDrawablesWithIntrinsicBounds(0, mImagesId[position], 0, 0);
In order to add border to the ImageView I defined a shape xml that I am using as a BackgroundResource.
How can I now add the shape to the TextView image up compound ?
View 1 Replies
View Related
Oct 27, 2010
I'm using xml file to define progress bar. I defined padding on background shape. But this setting will be sometimes displayed correctly, sometimes not. So If I start my application or Activity with progressbar inside, there will be correctly displayed progressbar with background and 'padded' progress. Then I close my application and start it again, and, progressbar is displayed without padded background, on next start will be displayed correctly and son on ... Could you please advice possible reasons for this?
xml file:..................
View 1 Replies
View Related
Dec 23, 2009
I dropped the following into the drawable directory in my Android 1.5 project: Code...
View 1 Replies
View Related
Nov 22, 2010
how can we create diamond shape view using 2D or 3D,I need to show the Images in that customized view instead of default ImageView class
View 2 Replies
View Related
May 3, 2010
I have the following code:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:width="1dp"/>
<size android:height="1dp" />
<solid android:color="#FFF"/>
</shape>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background ="@drawable/line"/>
Why the line is black instead white? I have tried putting it inside a ImageView but the result is the same.
How can i set the opacity of the shape?
View 1 Replies
View Related
Oct 20, 2010
I am developing a application which needs to change the color of the irregular shape such as the shape of a rabbit...but you know, if you use the APIs,you will change all color of the rectangle shape.
View 2 Replies
View Related
Mar 25, 2010
Is there a way that I can specify a triangle shape in an xml file?
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="triangle">
<stroke android:width="1dip" android:color="#FFF" />
<solid android:color="#FFF" />
</shape>
can we do this with a path shape or something? I just need an equilateral triangle.
View 1 Replies
View Related
Oct 25, 2009
I have a shape with a gradient that I'm using as a divider between ListView items. I've defined it as follows:
<?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#ccd0d3"
android:centerColor="#b6babd"
android:endColor="#ccd0d3"
android:height="1px"
android:angle="0" />
</shape>
I would like to add 6 pixels of padding on either side of the gradient, so that it doesn't extend from edge to edge of the screen.
However, no matter where I put an android:left="6px" and android:right="6px", it doesn't seem to take effect. I can put it in the <shape> element, the <gradient> element, or in a separate <padding> child of <shape>, and it doesn't change anything.
How can I add padding on the left and right of my list divider?
View 2 Replies
View Related
Aug 15, 2009
I am trying to set padding in shape declared in XML file. But whatever I set, nothing changes related to padding. If I modify any other properties, I see updated UI. But it doesn't work with padding. Could you please advice possible reasons for this?
I will provide below example of my shape.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<stroke android:width="1dp" android:color="#ffffff" android:dashWidth="2dp"/>
<solid android:color="@color/button_white_cover" />
<corners android:radius="11dp" />
<padding android:left="1dp" android:top="20dp"
android:right="20dp" android:bottom="2dp" />
</shape>
View 1 Replies
View Related
May 15, 2010
Is it possible to change the default shape (i.e rectangular) of the button (normal button as well as imagebutton) to something else maybe like star or a triangle in Android?
View 1 Replies
View Related
Aug 20, 2010
The Canvas class does not take Shape as a parameter for any of its methods. There is no drawShape or clipShape, etc... So, I need to use Path instead. Does android sdk expose any way to convert Shape to Path or Path to shape? I haven't been able to find relationship any between the 2 classes...?
View 1 Replies
View Related
Nov 8, 2010
I want to change my Button shape to an oval like button.
View 2 Replies
View Related
Jul 2, 2010
I want to draw a bitmap into a shape (in this case an isosceles trapezoid); not clipped, but with the bitmap transformed to fit the shape. For example, if the height of the left side is greater than that of the right side then I want the bitmap evenly transformed in height from left to right to match the height difference. The only method I can find to do this is drawBitmapMesh, however this produces some strange results. I have searched extensively and can find no concrete information on drawBitmapMesh.
To demonstrate the example, I have a bitmap which contains an even grid of vertical and horizontal lines. I use bitmap mesh with the code shown below. However, the horizontal lines of the grid do not evenly merge downwards from the top and upwards from the bottom towards the target. Rather, horizontal lines to the left of the line dissecting the top-left to bottom-right diagonal of the shape slant downwards to the left, lines to the right of the same diagonal slant downwards to the right. I also note that that the top line of the bitmap increases slightly in height from left before descending again to the right.
Perhaps drawBitmapMesh is not the method I should be using, or perhaps I am using it incorrectly.
CODE:...................
View 2 Replies
View Related