android


Creating secondary progress bar using multiple clips drawable


I am creating progress bar using imageview with layer list of clip drawable and it is working like a charm. Here is the code:
The xml of background drawable:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="#android:id/background">
<bitmap android:src="#drawable/energy_backing" >
</bitmap>
</item>
<item android:id="#android:id/progress">
<clip
android:clipOrientation="horizontal"
android:drawable="#drawable/energy_full"
android:gravity="left" />
</item>
</layer-list>
The xml of progress bar:
<ImageView
android:id="#+id/pbEnergyBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:layout_centerHorizontal="true"
android:src="#drawable/progress_bar_energy2" />
And offcourse I can set the progress by calling imageview.setImageLevel(progress).
My question is , how can I add a secondary progress bar like the one in default ProgressBar ?
I thought of adding another clip drawable but then how can I call setLevel twice on two different clips? any guidance!
Thank you
You could just add another ImageView with the secondary layer list and lay it out exactly on top of the first ImageView...
EDIT: Actually, you might be able to use ProgressBar with your drawable.
add another layer to your list with <item android:id="#android:id/secondaryProgress">
in ProgressBar set android:progressDrawable="#drawable/progress_bar_energy2"
See if that works.

Related Links

Fragment initialization with complex object
django + django_allauth + android application
Calling activity to another activity using intent failed
Play 2 audio files in same activity
How to activate all skin buttons and keys in android emulator
Creating R files fails in ADT 22 when bulding from ant and modifing the manifest file
How to stream video across LAN in android VideoView
rule of picture/preview size in Android Camera
How to choose constructor based on API level (ResourceCursorAdapter) android
Why do I get java.lang.ExceptionInInitializerError when I start the android app which uses tes two OCR engine
Live Video Stream support for android?
Android - Having button disabled after second usage
Trigger Android stock MMS app to send out pending messages
Android app doesn't use system proxy
Option menu in Android like a Windows 8 phone
Extends vs incompatible Android

Categories

HOME
adal
checkstyle
redux-form
toolbox
error-handling
entity-framework-core
dojo
tvos
rcloud
categorical-data
appcelerator-studio
plist
symfony-2.8
wolframalpha
xmonad
ag
articulate-storyline
epsilon
draft-js-plugins
google-cloud-print
pylons
corpus
linked-data
8051
genexus-sd
handler
angular-translate
winpe
sqsh
livelink
jmockit
rselenium
reactjs.net
installscript
modalviewcontroller
reverse
yowsup
fiware-cygnus
protege4
reactivekit
recurrent-neural-network
urlsession
berkeley-db-je
httrack
ntvs
linter
scalding
semantic-logging
google-photos
materialized-path-pattern
custom-lists
flex-monkey
segment-io
jboss-tools
i386
lean
embedding
database-relations
nio2
realsense
cycle2
libvlc
custom-errors
java-money
intel-c++
iced-coffeescript
zscript
viola-jones
uncompress
vacuum
google-refine
telepat
snackbar
gamekit
showdialog
mruby
easyrtc
wcm
ss7
grails-domain-class
memset
embedded-fonts
cffile
nevron
time.h
pclzip
lambdaj
predicatebuilder
creole
umra
w3c-geolocation
cloudfiles
nhprof
load-time
instantiationexception
request-headers
entitykey
appliance

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App