Search code examples
androidandroid-layoutandroid-custom-viewandroid-seek

Seekbar for accounting transaction.


Hey I am making an official purpose app which conclude business transaction.

I want a Bar or SeekBar view which shows Income or Expense of company like this

  • Red for if expense Exceeds
  • Green for if Income Gained

enter image description here

Hopefully We have this type of customview in many apps.

Please Help me out with this..!!


Solution

  • progress_bar.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>
                <solid android:color="#FF0000" />
            </shape>
        </item>
        <item android:id="@android:id/progress">
            <clip>
                <shape>
                    <solid android:color="#00FF00" />
                </shape>
            </clip>
        </item>
    </layer-list>
    

    Code:

     SeekBar mSeekBar = (SeekBar) findViewById(R.id.seekBar1);
        mSeekBar.setProgressDrawable(getResources().getDrawable(R.drawable.progress_bar));