FileDocCategorySizeDatePackage
ScaleDrawableTests.javaAPI DocAndroid 5.1 API2708Thu Mar 12 22:22:44 GMT 2015com.android.test.dynamic

ScaleDrawableTests

public class ScaleDrawableTests extends android.app.Activity

Fields Summary
private static final String
LOGCAT
private String[]
scaleTypes
protected int
icon
protected int
vector_icon
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle savedInstanceState)


    
        
        super.onCreate(savedInstanceState);
        ScrollView scrollView = new ScrollView(this);
        GridLayout container = new GridLayout(this);
        scrollView.addView(container);
        container.setColumnCount(3);
        container.setBackgroundColor(0xFF888888);

        LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        params.width = 400;
        params.height = 300;

        for (int i = 0; i < scaleTypes.length; i++) {
            TextView t = new TextView(this);
            t.setText(scaleTypes[i]);
            container.addView(t);

            ImageView.ScaleType scaleType = ImageView.ScaleType.values()[i];

            ImageView png_view = new ImageView(this);
            png_view.setLayoutParams(params);
            png_view.setScaleType(scaleType);
            png_view.setImageResource(icon);
            container.addView(png_view);

            ImageView view = new ImageView(this);
            view.setLayoutParams(params);
            view.setScaleType(scaleType);
            view.setImageResource(vector_icon);
            container.addView(view);
        }

        setContentView(scrollView);