-7

I have a psd gui layout of a progress bar. I want to slice it up and use it in android app. The problem is , unlike a button , how does one add dynamic elements to the static psd layers like progress and movement to the bar .

nhaarman
  • 98,571
  • 55
  • 246
  • 278
  • 3
    Nooooo... **you can't use psd files**, sorry. You have to convert them to **png** s. Dynamic elements (such as ProgressBars) can be created by saving some layers as 9 patches (Google for them) and some as layer lists (with an element which takes advantage of the useLevel attribute - also Google on this) – Phantômaxx Jul 29 '14 at 19:04
  • I did mention "slice" psd layers in the sense that they would be sliced and made into pngs(This is quite understandable i guess) . My question however is how to use these sliced up "pngs" in the progress bar. I recommend you guys read the question properly before jumping on to find whats wrong with the question. – Imperfectluck Jul 29 '14 at 21:58
  • 1
    No. You never talked about PNGs. You talked about PSDs. Don't give for granted that everyone has your graphic designer skills and terminology. Your question contains some issues. Anyway I recommend you to read my comment, which actually answers your question, specially this part: `layer lists (with an element which takes advantage of the useLevel attribute - also Google on this)` – Phantômaxx Jul 30 '14 at 07:12
  • I said slice psd s .Its not a terminology its common sense..well never mind about that... Anyway I know how to use layer lists.But The part of adding images to layer lists is what am asking here as a question. – Imperfectluck Jul 30 '14 at 21:29
  • "slice psd" is not "common sense". It's **your** logic. – Phantômaxx Jul 30 '14 at 21:33
  • oh well.thank you for your "VALUABLE" inputs..very constructive – Imperfectluck Jul 30 '14 at 22:05
  • 1
    Your sarcasm is really out of place. – Phantômaxx Jul 31 '14 at 07:06

1 Answers1

2

First, you need to export your PSD file to a PNG or similar format and put it in your drawable folder. Do the following in your XML:

<ProgressBar
  android:id="@+id/progressBar1"
  style="?android:attr/progressBarStyleHorizontal"
  android:progressDrawable="@drawable/custom_progressbar"         
  android:layout_width="wrap_content"
  android:layout_height="wrap_content" />

At run time do the following

// Get the Drawable custom_progressbar                     
Drawable draw=res.getDrawable(R.drawable.custom_progressbar);
// set the drawable as progress drawable
progressBar.setProgressDrawable(draw)

From this answer

Community
  • 1
  • 1
crocboy
  • 2,887
  • 2
  • 22
  • 25
  • I got this working,because this link just uses color (see start color and end color inside the clip) .BUt i want to use specific pngs for the progress and backgorund so that i get an effect like so..http://freebiesbug.com/psd-freebies/circle-progress-bar/ . As u can see ,the link itself is a psd ..so where do I add the progress image part in the xml – Imperfectluck Jul 29 '14 at 21:53
  • Yes ,i had seen the link you mentioned earlier. It however gives no way to set a glossy image to the progress bar and rather uses a start and end color. – Imperfectluck Jul 29 '14 at 22:01
  • Yeah this works, if you play around with it...so probably selecting as the correct answer... – Imperfectluck Jul 30 '14 at 22:04