我有一个具有自定义属性的自定义布局,其中一个是颜色。我让用户将该属性设置为颜色(不是普通颜色),我使用TypedArray的getColor方法检索该颜色并将其设置为整数(如果我将该整数打印出来,则为负值)。假设我做了这样的事情:TypedArray ta = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable
我想问,这两宗个案有甚麽分别呢?unsigned int i;printf("%d",i);unsigned int a=-5;它会在屏幕上打印-5。现在第1种情况的原因是,i被声明为unsigned int,因此不能接受负的值,因此总是大于0。
但是在第二种情况下,如果a不能取负值,为什么-5要打印?