Android Programming Cookbook
119 / 143
Android StackView Example The Honeycomb Android version, introduced some interesting widgets with collections. One of them is the Android StackView, a stacked card view where the front view-item can be flipped to give room for the item after it. The StackView collection may be found in several widgets, because of its view behaviour. Generally, StackView is an AdapterView thus working with StackView is not significantly different than is working with any other AdapterView. You create an Adapter defining the contents (in this case, defining the cards), you attach the Adapter to the StackView, and put the StackView somewhere on the screen. However StackView seems to work best with children that have explicit sizes. In this example we are going to see how to design and implement a simple Android StackView. For this example we are using the following tools in a Windows 64-bit or an OS X platform: • JDK 1.7 • Android Studio 2.1.2 • Android SDK 6.0 Let’s take a closer look:
Create a New Android Studio Project
Open Android Studio and choose “Start a new Android Studio Project” in the welcome screen.