How to get Android system Colors?

后端 未结 3 2174
日久生厌
日久生厌 2021-02-20 08:03

I\'m searching way to get Android system colors - color theme used in device.

Using android:color/ I didn\'t get correct colors. For example: background col

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-20 08:26

    Thanks for rekire :)

    Finally I have the answer: Android: How to get background color of Activity in Java?

    TypedArray array = getTheme().obtainStyledAttributes(new int[]{android.R.attr.colorBackground,}); 
    int backgroundcolor = array.getColor(0, 0xFF00FF);
    

提交回复
热议问题