gpt4 book ai didi

android - 将android中XYplot的背景颜色更改为白色?

转载 作者:行者123 更新时间:2023-11-29 00:25:27 26 4
gpt4 key购买 nike

这是我的 XML 文件,我想将 android 中此 XY 图的背景颜色更改为白色?我尝试了一些代码,但它没有改变。

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<LinearLayout
android:id="@+id/LinearLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:paddingTop="50dp" >

<TextView
android:id="@+id/values"
android:layout_width="264dp"
android:layout_height="34dp"
android:layout_weight="0.57"
android:hint="heart beat values"
android:paddingBottom="90dp"
android:textSize="20sp" />

<com.Android.XYPlot
android:id="@+id/dynamicPlot"
android:layout_width="fill_parent"
android:layout_height="230dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="@drawable/ic_launcher"
android:paddingBottom="5dp" />
</LinearLayout>

</ScrollView>

我试过这些东西来改变我的背景颜色,但它不起作用。

     dynamicPlot.setBackgroundColor(getResources().getColor(Color.WHITE));

如果可能的话,我也想删除背景中的网格..

   dynamicPlot.getLayoutManager().remove(dynamicPlot.getLegendWidget());

我试过这个用于删除网格线但没有用。

所以请帮帮我..

是否可以更改背景颜色?我正在绘制折线图,​​我可以更改图中线条的颜色。但是如何更改背景?是默认颜色吗?

最佳答案

      dynamicPlot.getGraphWidget().getDomainGridLinePaint().setColor(Color.TRANSPARENT);
//set all domain lines to transperent

dynamicPlot.getGraphWidget().getRangeSubGridLinePaint().setColor(Color.TRANSPARENT);
//set all range lines to transperent

dynamicPlot.getGraphWidget().getRangeGridLinePaint().setColor(Color.TRANSPARENT);
//set all sub range lines to transperent

dynamicPlot.getGraphWidget().getDomainSubGridLinePaint().setColor(Color.TRANSPARENT);
//set all sub domain lines to transperent


dynamicPlot.getGraphWidget().getGridBackgroundPaint().setColor(Color.WHITE);
//set background to white to transperent

关于android - 将android中XYplot的背景颜色更改为白色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19993725/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com