나는, RGB 값을 사용하지 않도록하기 위해 노력하고있어 그래서이 방법 : 내가 전달하는데있어AndroidPlot : 배경 및 colors.xml 자원 ID에 전달할 때 LineAndPointFormatter는 충돌을 야기
public LineAndPointFormatter(Integer lineColor, Integer vertexColor, Integer fillColor) {
this(lineColor, vertexColor, fillColor, FillDirection.BOTTOM);
}
:
LineAndPointFormatter lpf = new LineAndPointFormatter(Color.rgb(0, 0, 200), null, Color.rgb(0, 0, 80));
는 잘 작동하지만, 나는이 방법을 사용하려면 :
public LineAndPointFormatter(Context ctx, int xmlCfgId) {
// prevent configuration of classes derived from this one:
if (getClass().equals(LineAndPointFormatter.class)) {
Configurator.configure(ctx, this, xmlCfgId);
}
}
그래서 나는 colors.xml 자원 ID와 사람을 사용 할 수 있습니다 "colorID"를 설정하고 나중에 전달하면 (colorID가 로그에 -65536 또는 그에 따라 약간의 변형으로 표시됨) 모든 그래프 색상의 나이를 지정하십시오. 이 코드 조각을 확장있어 클래스 내에, 그래서 올바른 컨텍스트를 얻고 있는지 궁금 해요 .. 여기
내가 해봤 것들 중 일부입니다 :LineAndPointFormatter seriesFormat = new LineAndPointFormatter(getActivity().getApplicationContext(), getResources().getColor(R.color.blue));
LineAndPointFormatter seriesFormat = new LineAndPointFormatter(getActivity().getApplicationContext(), colorID);
LineAndPointFormatter seriesFormat = new LineAndPointFormatter(getActivity().getApplicationContext(), getResources().getColor(colorID));
등을 ..
필자는 pluggin을 멀리 두지 만 Context 버전의 LineAndPointFormatter를 사용하고 있다면 비슷한 문제가 발생했을 수 있습니까?
05-14 12 : 47 :
예외는 다음과 같습니다 25.917 : E/AndroidRuntime (14023) : android.content.res.Resources $ NotFoundException :
해야합니까 0xff0000ff 자원 ID 번호 내 색상을 # ff0000ff 형식으로 다시 작성해야합니까 ??
편집 : 추가 colors.xml
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<color name="white">#FFFFFF</color>
<color name="transparent_white">#66FFFFFF</color>
<color name="yellow">#FFFF00</color>
<color name="fuchsia">#FF00FF</color>
<color name="red">#FF0000</color>
<color name="silver">#C0C0C0</color>
<color name="gray">#808080</color>
<color name="olive">#808000</color>
<color name="purple">#800080</color>
<color name="maroon">#800000</color>
<color name="aqua">#00FFFF</color>
<color name="lime">#00FF00</color>
<color name="teal">#008080</color>
<color name="green">#008000</color>
<color name="blue">#0000ff</color>
<color name="navy">#000080</color>
<color name="black">#000000</color>
</resources>
안녕하세요 whyoz, xmlCfgId – Nick
@ 닉에 해당하는 xml 파일의 내용을 게시하고 colors.xml을 추가하고 업데이트하기 위해 #ff0000ff의 투명도 형식을 추가했는데 동일한 오류가 발생했습니다. – whyoz