Questions tagged [android-shapedrawable]

Android Drawable object that draws primitive shapes. A ShapeDrawable takes a Shape object and manages its presence on the screen. This object can be defined in an XML file with the element.

A Drawable object that draws primitive shapes. A ShapeDrawable takes a Shape object and manages its presence on the screen. If no Shape is given, then the ShapeDrawable will default to a RectShape.

This object can be defined in an XML file with the element, that defines a geometric shape, including colors and gradients. Creates a ShapeDrawable.

Useful links

102 questions
816
votes
23 answers

How to put a border around an Android TextView?

Is it possible to draw a border around an Android TextView?
yamspog
  • 18,173
  • 17
  • 63
  • 95
634
votes
21 answers

How to make layout with rounded corners..?

How can I make a layout with rounded corners? I want to apply rounded corners to my LinearLayout.
Addy
  • 6,363
  • 3
  • 14
  • 13
323
votes
8 answers

How to create EditText with rounded corners?

How to create an EditText that has rounded corners instead of the default rectangular-shaped corners?
pixel
  • 24,905
  • 36
  • 149
  • 251
229
votes
12 answers

Rounded corner for textview in android

I have a textview and want its corner to be in round shape. I already know it can be done using android:background="@drawable/somefile". In my case, this tag is already included so cannot use again. e.g android:background="@drawable/mydialogbox" is…
Sanjeev Yadav
  • 2,921
  • 7
  • 24
  • 23
29
votes
4 answers

How to change the shape of Floating Action Button (FAB) on android?

In our android app we need to create a floating action button which isn't the default circle but a square with with three rounded corners. The fab looks like in the image below: I managed to create such a form but don't know how to apply it to my…
18
votes
1 answer

Android: Drawing custom shapes

I want to draw a custom shape like this-. One option is to make each shape in photoshop individually and then use it in coding but I want to know that is it possible to draw this using xml? How should I draw the shape like this? Don't expect…
Rohan Kandwal
  • 9,112
  • 8
  • 74
  • 107
14
votes
4 answers

ImageView with only one rounded corner

I'm trying to make one rounded corner of ImageView like in the picture below but with bottom right corner. Tried using background shape but it's not working at all. All images loaded by Glide. Should i use something like ViewOutlineProvider? Is…
13
votes
1 answer

Shape drawable in layer-list rendered incorrectly for APIs below 23

Yesterday, I've switched to Android Studio version 2.1.3. Today, I've re-opened one of my projects and tried to add some layer-list drawables for use with an ImageView. For example this one:
Bö macht Blau
  • 12,820
  • 5
  • 40
  • 61
11
votes
4 answers

How to build trapezoid shape in xml android?

I want to build this shape with bottom line and text inside it i'm confused little bit how to achieve this i tired some code but don't get required thing. so far i have tried this code shape.xml
Nouman Ch
  • 4,023
  • 4
  • 29
  • 42
11
votes
1 answer

prevent partial overlapping of shape drawable stroke

Is there any way to prevent partial overlapping of the stroke on the shape drawable. I prefer to overlap the stroke completely on the borders of the shape. Here is my xml
Mohammed Atif
  • 4,383
  • 7
  • 28
  • 57
9
votes
1 answer

How to make a circular drawable with stroke, programmatically?

Background I'm trying to have a filled circle, with a stroke of certain color and width, and an image inside. This can easily be done in XML, as such (this is just a sample) :
android developer
  • 114,585
  • 152
  • 739
  • 1,270
9
votes
2 answers

Cutting the corners off a layout

I have a layout in android that needs to be a certain shape, i.e. this: where the corners are cut off. Is there a way of doing this programatically without setting the background of the layout to the image? I'm looking to keep the app size as small…
MichaelStoddart
  • 5,571
  • 4
  • 27
  • 49
8
votes
3 answers

Android: Add neon glow effect to button

I want to have a glow effect on button (in android studio) as shown in image: I didn't want an image for the background, so to get this effect, I have tried to do in xml file. I have added a stroke for the button and provide a shadow to the button…
7
votes
2 answers

Android - How to create a view with rounded corners and a tiled image background?

I'm trying to create a view in Android that has rounded corners and also uses a tiled image background (and which appears on top of another view with a tiled background). I can create a shape drawable for the corners and a bitmap drawable for the…
6
votes
3 answers

Android: Is there a simple way to create rounded corners for a view without having to create a separate drawable each time?

I have gone through various solutions on the internet, which enable us to create views with rounded corners. Most of them require the use of creating custom views, or to create a drawable in xml or a nine-patch each time we need a rounded corner…
1
2 3 4 5 6 7