Questions tagged [shapedrawable]

99 questions
1
vote
1 answer

How to combine shape drawable and drawable into single drawable

I am generating shape drawable and drawable runtime in android programmatically. What all I need is to combine two drawable into single drawable. I tried to implement through following methods, but nothing seems to work out. Sample code to combine…
1
vote
1 answer

Shape Drawable does not show in ImageView

I am trying to make rectangular blocks in my Android app. I tries to use Shape Drawable but it does not work. rectangle.xml:
1
vote
1 answer

Designing Android Drawable Shapes

I'm using Android Studio, is there any better way of designing shapes other then in XML, a designer tool with some sort of a preview would be good. Any other advice on how to best work with shapes ?
AlexVPerl
  • 7,652
  • 8
  • 51
  • 83
1
vote
0 answers

How to transform these shapes from xml to java code?

I'm searching on google how to transform these shapes to java code but I can't find the way, also I checked the documentation and nothing... These are the shapes: shape1.xml:
NullPointerException
  • 36,107
  • 79
  • 222
  • 382
1
vote
1 answer

chagnge color of shape drawable programatically

i need to chage color of shape drawable programatically... i am using this
Sanket Kachhela
  • 10,861
  • 8
  • 50
  • 75
1
vote
1 answer

Scaling then rotating a rectangle drawable

I would like to scale a rectangle drawable downwards, then rotate it so once it is clipped by the view it resembles a trapezoid with the left side slanted: The rotation is working fine:
1
vote
1 answer

How may i use the thread in my program?

I want to move the image on screen using thread I have tried but its not working fine due to improper code of thread. I am able to get the image and i want to move the image on screen In this code i want to move ovalshaped image and i dont want that…
nawaab saab
  • 1,892
  • 2
  • 20
  • 36
1
vote
2 answers

android adding dots line to layout

i need to add a line of dots to my layout like this this is my layout
iCaesar
  • 421
  • 2
  • 10
  • 23
1
vote
1 answer

detect if a touch event happens inside a shapeDrawable

I am drawing a number of ShapeDrawables through a canvas in a custom android view. I have an onTouchEvent method and it's working fine. Everything is working fine. Now I want to be able to detect if a touch event intersects (i.e. happens inside) a…
learner
  • 11,490
  • 26
  • 97
  • 169
1
vote
1 answer

Missing display of rounded corners in Android shape drawable (only on Samsung Galaxy Tab 7.0)

I'm just trying to display a stroked rectangle (stroke width 1dp) with rounded corners (radius 3dp). Everything looks fine on most devices, but the corners are not displayed correctly on Samsung Galaxy Tab 7.0 plus N. Here's the code:
Flo
  • 2,309
  • 20
  • 27
1
vote
1 answer

How can I draw a progressing ring with a gradient in Android?

I have a ShapeDrawable Object in my class in the form of an arc. ShapeDrawable progressArc = new ShapeDrawable(new ArcShape(120, 12)); Now I would like to use a radial gradient effect on the color and also display just a ring instead of a filled…
Ahmed Faisal
  • 4,397
  • 12
  • 45
  • 74
1
vote
1 answer

android - Programmatically turn on/off blink/flipper animation/effect for a ShapeDrawable (RectShape)

Below is the code necessary to draw a rectangle. How would it be possible without using some Runnables to make it blink? Is there an option to make this? Or maybe I should put a blinking background gif? ShapeDrawable ohMyShape = new…
duru
  • 270
  • 4
  • 14
1
vote
1 answer

Android: Advanced Gradient Styling

Please excuse the lack of imagery I'm trying to make my list view pop a little bit. One option i'm experimenting with is to add a gradient to the background of each list row. The gradient has three colors and by default resembles this structure: --…
Sababado
  • 2,524
  • 5
  • 33
  • 51
1
vote
1 answer

Difference between shape drawable and canvas.draw, workaround?

I'm using two ways to display buttons and edit texts in my application : one is by using a xml shape drawable, and applying it to the background of a button/edittext, the other is by using a canvas in a custom view. I expect the result to be exactly…
c-val
  • 181
  • 1
  • 2
  • 13
0
votes
1 answer

How to add initial padding to progress bar by java code

I want to add initial padding to progress bar, but that would be dynamic, as i am retrieving that value for initial padding from local database. I have set progress bar's background with layer-list xml file. `
Zoombie
  • 3,590
  • 5
  • 33
  • 40