FileDocCategorySizeDatePackage
DrawableBgMinSize.javaAPI DocAndroid 1.5 API3318Wed May 06 22:42:02 BST 2009com.android.frameworktest.drawable

DrawableBgMinSize

public class DrawableBgMinSize extends android.app.Activity implements android.view.View.OnClickListener
Views should obey their background {@link Drawable}'s minimum size requirements ({@link Drawable#getMinimumHeight()} and {@link Drawable#getMinimumWidth()}) when possible.

This Activity exercises a few Views with background {@link Drawable}s.

Fields Summary
private boolean
mUsingBigBg
private android.graphics.drawable.Drawable
mBackgroundDrawable
private android.graphics.drawable.Drawable
mBigBackgroundDrawable
private android.widget.Button
mChangeBackgroundsButton
private android.widget.TextView
mTextView
private android.widget.LinearLayout
mLinearLayout
private android.widget.RelativeLayout
mRelativeLayout
private android.widget.FrameLayout
mFrameLayout
private android.widget.AbsoluteLayout
mAbsoluteLayout
Constructors Summary
Methods Summary
private voidchangeBackgrounds(android.graphics.drawable.Drawable newBg)

        mTextView.setBackgroundDrawable(newBg);
        mLinearLayout.setBackgroundDrawable(newBg);
        mRelativeLayout.setBackgroundDrawable(newBg);
        mFrameLayout.setBackgroundDrawable(newBg);
        mAbsoluteLayout.setBackgroundDrawable(newBg);
    
public voidonClick(android.view.View v)

        if (mUsingBigBg) {
            changeBackgrounds(mBackgroundDrawable);
        } else {
            changeBackgrounds(mBigBackgroundDrawable);
        }
        
        mUsingBigBg = !mUsingBigBg;
    
protected voidonCreate(android.os.Bundle icicle)

    
    
        
        super.onCreate(icicle);
        
        setContentView(R.layout.drawable_background_minimum_size);
        
        mBackgroundDrawable = getResources().getDrawable(R.drawable.drawable_background);
        mBigBackgroundDrawable = getResources().getDrawable(R.drawable.big_drawable_background);
 
        mChangeBackgroundsButton = (Button) findViewById(R.id.change_backgrounds);
        mChangeBackgroundsButton.setOnClickListener(this);
        
        mTextView = (TextView) findViewById(R.id.text_view);
        mLinearLayout = (LinearLayout) findViewById(R.id.linear_layout);
        mRelativeLayout = (RelativeLayout) findViewById(R.id.relative_layout);
        mFrameLayout = (FrameLayout) findViewById(R.id.frame_layout);
        mAbsoluteLayout = (AbsoluteLayout) findViewById(R.id.absolute_layout);

        changeBackgrounds(mBackgroundDrawable);