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 package com.android.test.dynamic; 15 16 import android.app.Activity; 17 import android.graphics.drawable.VectorDrawable; 18 import android.os.Bundle; 19 import android.util.Log; 20 import android.view.View; 21 import android.widget.Button; 22 import android.widget.CheckBox; 23 import android.widget.GridLayout; 24 25 @SuppressWarnings({"UnusedDeclaration"}) 26 public class VectorCheckbox extends Activity { 27 private static final String LOGCAT = "VectorDrawable1"; 28 int[] icon = { 29 R.drawable.vector_drawable01, 30 R.drawable.vector_drawable02, 31 R.drawable.vector_drawable03, 32 R.drawable.vector_drawable04, 33 R.drawable.vector_drawable05, 34 R.drawable.vector_drawable06, 35 R.drawable.vector_drawable07, 36 R.drawable.vector_drawable08, 37 R.drawable.vector_drawable09, 38 R.drawable.vector_drawable10, 39 R.drawable.vector_drawable11, 40 R.drawable.vector_drawable12, 41 R.drawable.vector_drawable13, 42 R.drawable.vector_drawable14, 43 R.drawable.vector_drawable15, 44 R.drawable.vector_drawable16, 45 R.drawable.vector_drawable17, 46 R.drawable.vector_drawable18, 47 R.drawable.vector_drawable19, 48 R.drawable.vector_drawable20 49 }; 50 51 @Override 52 protected void onCreate(Bundle savedInstanceState) { 53 super.onCreate(savedInstanceState); 54 GridLayout container = new GridLayout(this); 55 container.setColumnCount(5); 56 container.setBackgroundColor(0xFF888888); 57 final Button []bArray = new Button[icon.length]; 58 59 for (int i = 0; i < icon.length; i++) { 60 CheckBox checkBox = new CheckBox(this); 61 bArray[i] = checkBox; 62 checkBox.setWidth(200); 63 checkBox.setButtonDrawable(icon[i]); 64 container.addView(checkBox); 65 } 66 setContentView(container); 67 } 68 } 69