我的应用程序有一个设置界面(settings_activity),用户可以在其中更改一些颜色(图标、文本等)。我想将这些颜色存储在sharedpreferences中,创建了一个类:
public class AppData {
static SharedPreferences prefdata;
static SharedPreferences.Editor editordata;
static final String FCOLOR_KEY = "#FFFFFF"; //first color
static final String SCOLOR_KEY = "#FFFFFF"; //second color
static final String TCOLOR_KEY = "#FFFFFF"; //text color
static final String ICOLOR_KEY = "#FFFFFF"; //icon color
static final Image BIMG_KEY = null; //bakcground image
}
颜色使用哪种值类型最好(int、string还是直接使用颜色)?
我如何通过使用settings_activity来更改appdata中的值,以及如何在xml文件中使用它(包括颜色)?我应该使用colors.xml(如何使用)吗?