Android :: Shape Drawable As Background Xml?
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
Dec 23, 2009
I dropped the following into the drawable directory in my Android 1.5 project: Code...
View 1 Replies
View Related
Jul 6, 2010
I have some problems finding the documentation of the definitions of shapes in XML for Android. I would like to define a simple circle filled with a solid color in an XML File to include it into my layout files.
Sadly the Documentation on android.com does not cover the XML attributes of the Shape classes. I think I should use an ArcShape to draw a circle but there is no explanation on how to set the size, the color, or the angle needed to make a circle out of an Arc.
View 3 Replies
View Related
Oct 2, 2010
I have a GLSurfaceView with a drawable as background, however only the background is visible when rendered without surfaceView.setZOrderOnTop(true)I need to avoid using setZOrderOnTop(true) because there are static TextView's being used on top of the GLSurfaceView. Any suggestions for getting this to work?
View 2 Replies
View Related
Oct 6, 2010
Just like Twitter for android used to have (they removed it) - I need to display an animated background drawable.
How to I show an image that is actually bigger then the given layout dimensions (without the image being shrink).
What kind of animation do I need to use for the "moving" effect?
View 12 Replies
View Related
Sep 9, 2009
On a layout I want to scale the background image (keeping its aspect ratio) to the space allocated when the page gets created. I am using layout.setBackgroundDrawable() and am using a BitmapDrawable to setGravity for clipping and filling, but don't see any option for scaling.
View 2 Replies
View Related
Sep 9, 2009
On a layout I want to scale the background image (keeping it's aspect ratio) to the space allocated when the page gets created. Anyone have any idea how to do this?
I am using layout.setBackgroundDrawable() and am using a BitmapDrawable to setGravity for clipping and filling, but don't see any option for scaling.
View 4 Replies
View Related
May 29, 2009
I have a custom view on which i have drawn some lines(to represent a grid) i want to use it as a background to another view!!!
View 2 Replies
View Related
Aug 18, 2009
I tried doing a ProgressBar and I wanted to change the background and the progress bar using my own drawables from the drawable resource. Is this possible? I just don't want to spend time creating my own custom component if can be done relatively easy.
View 4 Replies
View Related
Nov 2, 2010
I'm going to be using
setBackgroundResource(R.drawable.background)
in my onCreate() method.
When I create the XML file with the and its colors, what type of resource am I creating? "values", "layout"?
View 1 Replies
View Related
Jun 30, 2010
I have a specific drawable that I use as background in my app. It is not a solid color.
Now I want to add rounded corners to this drawable.
I only found the rounded corner available in a shape with a gradient or a solid color as a background but not another drawable.
Is there another easy way of adding rounded corners to a drawable?
View 3 Replies
View Related
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
Oct 19, 2010
I am running my application in the emulator using a high density skin (like WVGA800). However the ressources in my application are loaded from the drawable- mdpi folder instead of drawable-hdpi ... what else should I do so that android use the correct folder ?
View 4 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 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
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
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
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