Android int to Int [] SimpleArc Loader(Color)

时间:2017-11-21 11:38:58

标签: android arrays colors

我正在使用这个库,但现在我需要改变颜色:

https://github.com/generic-leo/SimpleArcLoader

但它说:

enter image description here

function done_Callback(hObject, eventdata, handles)
% hObject    handle to done (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% save the parameters to file

load('m.mat');
m = [nunof, nduef, ntref, nquattrof];
nunof = str2num(get(handles.final1,'String'));
nduef = str2num(get(handles.final2,'String'));
ntref = str2num(get(handles.final3,'String'));
nquattrof = str2num(get(handles.final4,'String'));

save('m.mat','-append');

如何在int []中转换Color int?

2 个答案:

答案 0 :(得分:2)

R.color.colorPrimary是资源ID而不是color或int数组,你应该给它一个RGB / ARGB颜色数组

configuration.setColors(new int[] {ContextCompat.getColor(context, R.color.colorPrimary)});

答案 1 :(得分:1)

创建颜色数组

int [] colors = new int[]{R.color.colorPrimary};

然后将其设置为configuration.setColors();这样的方法

configuration.setColors(colors);

或者只是像这样使用

configuration.setColors(new int[]{R.color.colorPrimary, R.color.colorPrimaryDark, R.color.colorAccent});