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

How to automatically push cordova app to playstore
Transition in navigation drawer android
Espresso testing ListView
Using tab-completed directory names in bash
Android - How kill process with ppid = 1
Chromecast does not resume after pause with error 2100
main Layout Overlaps with Navigation Drawer
Firebase Realtime Database is taking too much time for the first time connection
Android - Recycler View item get swapped when scrolled
Mock location Check failed with “Fake GPS Go”
grid/table cell expanding to use available space
Error while removing fragment containing videoView in 4.0.4
cordova-plugin-camera : Restrict to a single directory in gallery view using intent setdataandtype?
Missing Dialog Buttons under Android 7.1.1
How to call a function only after getting response from API in android?
Most secure way of sending data between activities in Android

Categories

HOME
android
sonarqube
facebook-oauth
jpa
fuelux
codenvy
components
saml-2.0
entity-framework-core
ado.net
jax-ws
barcode
computer-science
extjs4.2
openstreetmap
datastage
openbugs
automatic-ref-counting
nancy
frequency-distribution
atlassian
scrolltop
magnetic-cards
atlassian-stash
google-picker
shortest-path
bourbon
swagger-2.0
enterprise-miner
articulate-storyline
springfox
string-concatenation
hta
pchart
flask-sqlalchemy
jboss6.x
user-defined-functions
mql
sqsh
magento-1.8
gitlab-api
testbed
hunspell
protege4
imagenet
apns-php
health-monitoring
jvmti
skylink
dcmtk
naming
sharp-snmp
show-hide
strftime
jide
dynamic-linq
lightning
otp
baidu
shinobi
android-instrumentation
polyline
gets
custom-lists
async.js
resourcemanager
jquery-jscrollpane
redis-cluster
html-to-pdf
ascii-art
inf
directdraw
sapi
oracle-spatial
botan
bufferedinputstream
delayed-execution
beatsmusic
ghcjs
trdion2011
jquery-slider
memset
model-driven-development
actiondispatch
onload-event
mantle
android-sdk-2.3
boost-msm
lambdaj
agility.js
clrstoredprocedure
timthumb
load-time
binomial-heap
web-garden
tabpanel
web-application-project
complex-event-processing

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