1/* 2 * Copyright (C) 2014 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except 5 * in compliance with the License. You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software distributed under the License 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express 11 * or implied. See the License for the specific language governing permissions and limitations under 12 * the License. 13 */ 14 15package com.android.test.dynamic; 16 17import android.app.Activity; 18import android.graphics.drawable.AnimatedVectorDrawable; 19import android.os.Bundle; 20import android.view.View; 21import android.widget.Button; 22import android.widget.CheckBox; 23import android.widget.GridLayout; 24import android.widget.ScrollView; 25 26public class AnimatedStateVectorDrawableTest extends Activity { 27 private static final String LOGCAT = "AnimatedStateVectorDrawableTest"; 28 29 protected int[] icon = { 30 // These shows pairs of ASLD , the left side set the reversible to true. 31 // the right side set to false. 32 R.drawable.state_animation_vector_drawable01, 33 R.drawable.state_animation_vector_drawable01_false, 34 R.drawable.state_animation_vector_drawable02, 35 R.drawable.state_animation_vector_drawable02_false, 36 R.drawable.state_animation_vector_drawable03, 37 R.drawable.state_animation_vector_drawable03_false, 38 R.drawable.state_animation_drawable04, 39 R.drawable.state_animation_drawable04_false, 40 }; 41 42 @Override 43 protected void onCreate(Bundle savedInstanceState) { 44 super.onCreate(savedInstanceState); 45 46 ScrollView scrollView = new ScrollView(this); 47 GridLayout container = new GridLayout(this); 48 scrollView.addView(container); 49 container.setColumnCount(2); 50 51 for (int i = 0; i < icon.length; i++) { 52 CheckBox button = new CheckBox(this); 53 button.setWidth(400); 54 button.setHeight(400); 55 button.setBackgroundResource(icon[i]); 56 container.addView(button); 57 } 58 59 setContentView(scrollView); 60 } 61} 62