package qwe.asd.zxc;
import android.app.Activity;
import android.content.Context; 
import android.graphics.Color; 
import android.graphics.ColorFilter; 
import android.graphics.LightingColorFilter; 
import android.graphics.drawable.Drawable; 
import android.graphics.drawable.LayerDrawable; 
import android.os.Bundle;
import android.util.AttributeSet; 
import android.widget.Button; 
public class WkpExActivity extends Activity {
    
  
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}
class SAutoBgButton extends Button {
 public SAutoBgButton(Context context) {
  super(context);   }  
 public SAutoBgButton(Context context, AttributeSet attrs) {
  super(context, attrs);   }    
 public SAutoBgButton(Context context, AttributeSet attrs, int defStyle) {     
  super(context, attrs, defStyle);   }       
  public void setBackgroundDrawable(Drawable d) {     
   SAutoBgButtonBackgroundDrawable layer = new SAutoBgButtonBackgroundDrawable(d);     
   super.setBackgroundDrawable(layer);   } 
  
  protected class SAutoBgButtonBackgroundDrawable extends LayerDrawable { 
          
   protected ColorFilter _pressedFilter = new LightingColorFilter(Color.LTGRAY, 1);
   protected int _disabledAlpha = 100; 
   
   public SAutoBgButtonBackgroundDrawable(Drawable d) { 
    super(new Drawable[] { d });     }  
   
    protected boolean onStateChange(int[] states) { 
     
     boolean enabled = false;
     boolean pressed = false; 
     
     for (int state : states) {    
      if (state == android.R.attr.state_enabled)   
       enabled = true;       
      else if (state == android.R.attr.state_pressed)  
       pressed = true;       } 
     
     mutate();   
       if (enabled && pressed) { 
        setColorFilter(_pressedFilter);       } else if
        (!enabled) {         
         setColorFilter(null);       
         setAlpha(_disabledAlpha);     
         } else {       
          setColorFilter(null);       }       
       invalidateSelf();       
       return super.onStateChange(states);     }  
    public boolean isStateful() {       
     return true;     } 
    } 
} 
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
    <Button
        android:layout_width="wrap_content"
        android:layout_height="154dp"
        android:layout_weight="0.85"
        android:background="@drawable/a"
        android:text="background image" />
    <your.dong.button.SAutoBgButton
        android:layout_width="wrap_content"
        android:layout_height="232dp"
        android:background="@drawable/a"
        android:text="background image" />
</LinearLayout>
 
자바 초보자인데요 저기 소스코드 인터넷에서 본건데 주석좀 달아주실수 있으신가요 ? ㅠ 급합니다.....