Java/Android String to Color conversion

后端 未结 4 1272
长发绾君心
长发绾君心 2021-02-15 02:12

I\'m making an app and I\'d like to be able to set various colors via user input(edittext) and hex values e.g. #eeeeee and so on. Problem is I cannot seem to figure out how to c

4条回答
  •  孤街浪徒
    2021-02-15 02:36

    http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Integer.html#parseInt(java.lang.String, int)

    For example:

    titlebar.setBackgroundColor(Integer.parseInt("545455", 16)+0xFF000000);
    

提交回复
热议问题