如何在 android 中使用渐变颜色制作水平条形图
How to make a horizontal bar chart using gradient color in android
我附上了截图。根据屏幕截图,我想将水平条形图制作成与快照相同的 activity。我已经使用 MP Chart Library 完成了一半的内容。我无法添加从 3 到 9 的 x 轴值。也无法添加垂直网格。
请建议我应该怎么做?
预先感谢您的帮助,我们将不胜感激。
在 /drawable 文件夹中为渐变创建一个 xml 文件,并将其应用到 LinearLayout 作为背景。角度必须为 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>
关于背景:尝试启用'aggregate' 单元格的GridLayout
。但这可能很棘手。
使用GraphView
http://www.android-graphview.org/
希望对您有所帮助。
我附上了截图。根据屏幕截图,我想将水平条形图制作成与快照相同的 activity。我已经使用 MP Chart Library 完成了一半的内容。我无法添加从 3 到 9 的 x 轴值。也无法添加垂直网格。
请建议我应该怎么做?
预先感谢您的帮助,我们将不胜感激。
在 /drawable 文件夹中为渐变创建一个 xml 文件,并将其应用到 LinearLayout 作为背景。角度必须为 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>
关于背景:尝试启用'aggregate' 单元格的GridLayout
。但这可能很棘手。
使用GraphView http://www.android-graphview.org/ 希望对您有所帮助。