| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
package com.android.test.dynamic; |
| 16 |
|
| 17 |
import android.app.Activity; |
| 18 |
import android.graphics.drawable.AnimatedVectorDrawable; |
| 19 |
import android.os.Bundle; |
| 20 |
import android.view.View; |
| 21 |
import android.widget.Button; |
| 22 |
import android.widget.CheckBox; |
| 23 |
import android.widget.GridLayout; |
| 24 |
import android.widget.ScrollView; |
| 25 |
|
| 26 |
public class AnimatedStateVectorDrawableTest extends Activity { |
| 27 |
private static final String LOGCAT = "AnimatedStateVectorDrawableTest"; |
| 28 |
|
| 29 |
protected int[] icon = { |
| 30 |
|
| 31 |
|
| 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 |
} |