StateListDrawable states = new StateListDrawable(); states.addState(new int[] {android.R.attr.state_pressed}, getResources().getDrawable(R.drawable.pressed)); states.addState(new int[] {android.R.attr.state_focused}, getResources().getDrawable(R.drawable.focused)); states.addState(new int[] { }, getResources().getDrawable(R.drawable.normal)); imageView.setImageDrawable(states); //YOUR IMAGE HERE //AND FOR BUTTON button.setBackgroundDrawable(states);//FOR BUTTON
'Programming > Android' 카테고리의 다른 글
[Android] 여러개 Intent를 묶어서 보내기. (2) | 2014.05.29 |
---|---|
[Android] Android에서 "Unknown error merging manifest" (0) | 2014.02.20 |
[Android] WebView 에서 getGeoLocation이 동작하지 않을 때( getGeoLocation is not working on Android Webview) onGeolocationPermissionsShowPrompt (0) | 2014.02.18 |
[Android] Fragment Width(넓이) (0) | 2014.02.06 |
[Android] Uri로 Bitmap 추출 (0) | 2014.01.09 |