2012-10-25 62 views

回答

4

你可以做这样的(从View子类):

setBackgroundResource(android.R.drawable.editbox_dropdown_dark_frame); 

如果你有到视图的引用(比如,从findViewById),你可以做同样的事情:

View v = . . .; 
v.setBackgroundResource(android.R.drawable.editbox_dropdown_dark_frame); 

如果你喜欢,你可以检索Drawable本身直接:

Drawable d = getResources().getDrawable(
    android.R.drawable.editbox_dropdown_dark_frame); 
1
<TextView 
android:id="@+id/background_tv" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content"/> 

TextView toChange = (TextView) this.findViewById(R.id.background_tv); 
toChange.setBackgroundResource(android.R.drawable.editbox_dropdown_dark_frame); 
相关问题