2017-04-21 66 views

回答

1

你可以得到类似的背景下面的代码

Drawable bgDrawable = imageViewNote.getBackground(); 
1

试试这个(你的背景实际上是一种颜色它只能在情况下,否则,你真的没有“背景”颜色“):

Drawable background = userNameTextView.getBackground(); 
    if (background instanceof ColorDrawable) { 
     int color = ((ColorDrawable) background).getColor(); 
     // Use color here 
    } 
1

尝试获得的ImageView的ColorDrawable?