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

Parsing a JSON file without arrays
Custom view uses data binding but layout is include'd, how can the view be aware of its own binding?
List item is detached from ListView even they are supposed to be shown on screen (Android 7.0)
Could not find support-v4.jar (com.android.support:support-v4:24.0.0)
Calling ShowViewModel on activity, does not show Child fragment
Retrofit gives connection timeout while uploading image using wifi with static ip address
Keep showing popupWindow when back button of keyboard is pressed
Invalid IP address from connecting HTTP client in Android studio
Chrome updates on Android emulator
How to set two or more DatePicker and Display it on TextView?
Hello World App crashing in Cordova 6.4.0
Andriod Listview fast scroll to bottom automatically when scroll in the middle
How to add Firebase custom events for analytics?
android adb take screenshot in specific resolution
Cordova geolocation not working on android5
How to perform an action after another one in Android Studio (Java)?

Categories

HOME
phpword
jpa
design-patterns
error-handling
babeljs
webix
nstableheaderview
lanczos
java.util.logging
gkturnbasedmatch
altera
atlassian-stash
null-pointer
mvc-mini-profiler
fileserver
xmonad
sigma.js
poedit
mongoid6
event-store
gmock
roundup
beta
beautifier
linked-data
tpm
magento-1.8
panoramas
utorrent
memory-address
android-sugarorm
hunspell
docfx
watchman
timing
sessionstorage
signals-slots
apriori
portforwarding
claims
dapper-simplecrud
puredata
pom.xml
jboss-4.2.x
sonarlint-eclipse
openblas
x-ray
subnet
jqchart
javafx-css
cubism.js
custom-lists
ziparchive
jquery-jscrollpane
qiime
cassia
lua-telegram-bot
gcloud-ruby
fink
qbxml
concurrentmodification
sapi
dllimport
wiredep
toolkit
cgi-bin
zscript
rdflib
git-ftp
kubuntu
phpldapadmin
android-cookiemanager
android-vibration
crowd
spy++
iso-prolog
wcm
trdion2011
insight.database
mintty
authlogic
maven-scm
synapse
windows-embedded-standard
mbunit
cmmi
android-sdk-2.3
android-loadermanager
tree-balancing
frameworkelementfactory
midlet
monotouch.dialog
os.system
thttpd
u2netdk
creole
strsep
quotation-marks
tmx
cac
metaweblog
squishit
tabpanel
cfwindow
strtod
tui
scrubyt
wspbuilder

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