Android get color as string value

前端 未结 11 1574
青春惊慌失措
青春惊慌失措 2021-01-30 19:28

If i defined a color in resources


    #123456

it\'s possible

11条回答
  •  青春惊慌失措
    2021-01-30 19:38

    The answers provided above are not updated.

    Please try this one

    String colorHex = "#" + Integer.toHexString(ContextCompat.getColor(getActivity(), R.color.dark_sky_blue) & 0x00ffffff);
    

提交回复
热议问题