Questions tagged [android-shape]

This is a generic shape defined in XML.

This is a generic shape defined in XML.

Reference: http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape

191 questions
2
votes
1 answer

create drawable shape of right angled triangle

I am trying to find out how to use drawable xml () to create a right angled triangle like below (but fill with color without the black line): I try to think from the angle of halving a rectangle from diagonal line, but still...can't find how…
Leem.fin
  • 40,781
  • 83
  • 202
  • 354
2
votes
0 answers

Semi transparent image background in Android shape xml

I want to make a rectange object (shape) with gradient and below it image background. I've got:
2
votes
0 answers

Setting Colour of shape not working in API 21/22 (GradientDrawable)

I have a shape which I need to change the colour of using the below code: @Override public View getView(int position, View convertView, ViewGroup parent) { // Get the data item for this position LockListDataModel locks =…
2
votes
1 answer

How to make shadow in layer-list?

The problem is as follows: I need to make in app widget some actionbar like this: For this I use layer-list with shape.
2
votes
1 answer

changing shape color programmatically in android

I am trying to change color of a shape in programmatically, but its not working. Here is the shape
AddyProg
  • 2,960
  • 13
  • 59
  • 110
2
votes
3 answers

Android button with transparent text

I have a button on an image. I would like to have this button with a solid background color and transparent text (to display the back image). Is it possible to make it have only transparent text?
Safari
  • 11,437
  • 24
  • 91
  • 191
2
votes
2 answers

Shape with selector as color doesn't works

I want to create a shape with selector as solid color. On Android 5.0+, this code works perfectly, but on 4.X, it doesn't works. shape.xml :
Florian Mac Langlade
  • 1,863
  • 7
  • 28
  • 57
2
votes
0 answers

9patch with custom background image

I've been working on this problem for 2 days now. What I'm trying to achieve is to make a bitmap fill the complete non-transparent background of a 9patch drawable (a speech bubble in this case). Instead of this I want something like this (Yes,…
2
votes
3 answers

How to create a custome shape in which image could be displayed?

In a project I have to show profile image and other images in a different shape. I don't know how to create a shape like it, and how to show an image in it. I have to put this type of shape in list view also. Please suggest me. Thanks in advance.
Ashish Tiwari
  • 2,168
  • 4
  • 30
  • 54
2
votes
0 answers

In XML shape, stroke width is set to 1px but it doesn't seem

Here's my XML code:
frogatto
  • 28,539
  • 11
  • 83
  • 129
2
votes
1 answer

How to display Text in Android Canvas ShapeDrawable with in the RectShape or OvalShape?

I'm trying to display Text in RectShape which uses ShapeDrawable to display in Canvas. I'm able to display RectShape in this code, but looking for how to display the String on that! public class CustomDrawableView extends View { private…
LOG_TAG
  • 19,894
  • 12
  • 72
  • 105
2
votes
1 answer

Circle shape height and width issues in xml

I created an Oval Shape and set the sizes 56px for each height and width. but i had an Oval Shape not a circle! when i set the sizes to 78px for each i get an exact circle! Anyone noticed or faced this issue? Solutions please! clear_test.xml this…
Borzstag
  • 43
  • 5
2
votes
3 answers

how can i show a square image in a circle?

I'm trying to mimic something from the iPhone version of my app. I have a square image and I want to show it in a circle with a white border around it. like this Is there a way I can do this?
birdy
  • 9,286
  • 24
  • 107
  • 171
1
vote
0 answers

How to spread children that display an XML shape evenly in a GridLayout (with maximum possible size)?

Here is what i want: I have a GridLayout inside of a ConstraintLayout, to which I add multiple rows and columns of custom ImageButtons (BoardCells) dynamically. The ImageButtons display circles using a shape XML file (code below). I want the…
1
vote
2 answers

Custom button design for round corners using layer list

I just wat to create a button as shown in the image. But I am not able to make the round edges at the top corners. How we can do that..please help.
Jithu
  • 117
  • 1
  • 10