android


Shape padding not working pre 6 Android


Seems like shape padding doesn't work on pre 6 Android. I'm trying to add padding to custom ProgressBar background gradient and that what I have:
Android 6.0:
Android 5.0 and below:
pb_shape.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#android:id/background">
<shape android:shape="rectangle">
<corners android:radius="12dip" />
<stroke
android:width="1dip"
android:color="#color/primary_white" />
<gradient
android:angle="270"
android:centerColor="#color/primary_black"
android:centerY="0.5"
android:endColor="#color/primary_black"
android:gradientRadius="12dip"
android:startColor="#color/primary_black" />
<!--This not working pre 6 android-->
<padding
android:bottom="4dp"
android:left="4dp"
android:right="4dp"
android:top="4dp" />
</shape>
</item>
<item android:id="#android:id/progress">
<clip>
<shape>
<corners android:radius="12dip" />
<gradient
android:angle="0"
android:endColor="#color/primary_teal"
android:startColor="#color/primary_blue_dark" />
</shape>
</clip>
</item>
I've already tried to wrap those both items in distinct xml files and set padding there like that but it takes no effect:
<item
android:bottom="4dp"
android:left="4dp"
android:right="4dp"
android:top="4dp"
android:drawable="#drawable/pb_gradient_bg"
/>
Any ideas what causes this behavior and what could be the solution?
Seems like I found a way round for this. It was needed to create transparent stroke for gradient with needed width and it does exactly what was needed.
For solution check my answer in similar question here
Happy coding :)

Related Links

Downsides of using Appcelerator Titanium (or equivalent)?
How do you create a layout with rectangular buttons on the top row?
onItemClick listener problem in ListView
sip conference call in android api level 9
gridview and setImageBitmap when load image from SDcard
Android: How to make UI thread to wait till AsycTask completes
Logs are not sent to my email
Parsing xml with multiple markup
you tube video not playing
android: how to add a new line
Android: When and how to save application data
how to pass value from activity to tabactivity
out of memory error in android app [duplicate]
How do I create a new menu in Android to undertake a certain action without opening up another preference window?
android google analytics: need onreceive()?
How to find the amount of free storage (disk space) left on Android?

Categories

HOME
algorithm
embedded
phpword
localization
c++11
opendj
cublas
interpolation
vsm
nfs
bing-maps
fosrestbundle
fhir
watson-conversation
jxl
spring-social
nancy
android-intent
azure-powershell
sencha-touch
replication
ag
rubymotion
ember-cli
itunes
syntax-highlighting
underscore.js
fractions
firebase-analytics
winexe
userdefaults
laravel-eloquent
login-script
joomla2.5
python-import
password-protection
bc
diacritics
attributeerror
preloader
microsoft-metro
x++
getchar
fwrite
libgphoto2
sonarlint-eclipse
chai-as-promised
datamaps
google-cse
carrot2
cpu-cache
branch-prediction
smartfoxserver
angular2-testing
omxplayer
builtins
synonym
jtwig
tracker-enabled-dbcontext
halcon
realsense
cycle2
blitline
crouton-os
sciruby
r-package
text-search
dock
ember-cli-rails
snackbar
dot.js
bcache
cosine-similarity
teaspoon
named-parameters
ora-00904
malformedurlexception
grails-plugin-rabbitmq
conditionaltagsupport
oocss
diem
joomla-template
swfobject
twisted.web
patricia-trie
zope.interface
oracle-enterprise-linux
kqueue
luabind
gobject-introspection
mtu
luajava
ie-compatibility-mode
object-database
binomial-heap
duplex
echo3
wysiwym

Resources

Encrypt Message