Java 类android.widget.StackView 实例源码

项目:codeexamples-android    文件:MainActivity.java   
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
StackView stk = (StackView)this.findViewById(R.id.stackView1);

ArrayList<StackItem> items = new ArrayList<StackItem>();
items.add(new StackItem("text1", this.getResources().getDrawable(R.drawable.ic_launcher)));
items.add(new StackItem("text2", this.getResources().getDrawable(R.drawable.ic_launcher)));
items.add(new StackItem("text3", this.getResources().getDrawable(R.drawable.ic_launcher)));
items.add(new StackItem("text4", this.getResources().getDrawable(R.drawable.ic_launcher)));
items.add(new StackItem("text5", this.getResources().getDrawable(R.drawable.ic_launcher)));

StackAdapter adapt = new StackAdapter(this, R.layout.item, items);

stk.setAdapter(adapt);

}