How to make horizontal bar graph using gradient color in android

I have attached a screenshot. As per the screenshot, I want to make the horizontal bar graph for my activity the same as the snapshot. I made half of the content using the MP Chart Library. I cannot add x-axis values ​​from 3 to 9. Also cannot add vertical grids.

enter image description here

Please suggest me what should I do?

Thanks in advance for your help and your little help would be appreciated.

+3


source to share


2 answers


Use GraphView http://www.android-graphview.org/ Hope this is helpful.



+2


source


Create an xml file for the gradient in the / drawable folder and apply it to the LinearLayout as a background. The angle must be 0.

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:startColor="#000000"
        android:endColor="#ff3399"
        android:angle="0"/>
</shape>


<LinearLayout 
    android:id="@+id/bar_1" 
    android:layout_width="wrap_content" 
    android:background="@drawable/my_gradient"> 
</LinearLayout>

      



As for the background: try GridLayout

one that allows you to "fill" the cells. But this can be tricky.

+1


source







All Articles